Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] We should give users 400 instead of 500 on OpenSearch errors #533

Open
vicilliar opened this issue Jul 7, 2023 · 1 comment · May be fixed by #857
Open

[BUG] We should give users 400 instead of 500 on OpenSearch errors #533

vicilliar opened this issue Jul 7, 2023 · 1 comment · May be fixed by #857
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@vicilliar
Copy link
Contributor

vicilliar commented Jul 7, 2023

Describe the bug
When creating an index with bad arguments, these are passed to OpenSearch and caught by their validation, giving Marqo a 400 and the user a 500. Marqo should catch this 400 and return a 400 to the user as well. Could simply be by wrapping this in a try except block: https://github.com/marqo-ai/marqo/blob/mainline/src/marqo/tensor_search/tensor_search.py#L152

Example

mq.create_index("test-index", settings_dict={"index_defaults": {"model": "my-custom-model", "model_properties":{"dimension": "BAD DIMENSION, NOT INT"}}})

Current Output

marqo.errors.MarqoWebError: MarqoWebError: MarqoWebError Error message: {'message': "{'error': {'root_cause': [{'type': 'mapper_parsing_exception', 'reason': 'Failed to parse mapping [_doc]: Unable to parse [dimension] from provided value [wegerg] for vector [__vector_marqo_knn_field]'}], 'type': 'mapper_parsing_exception', 'reason': 'Failed to parse mapping [_doc]: Unable to parse [dimension] from provided value [wegerg] for vector [__vector_marqo_knn_field]', 'caused_by': {'type': 'illegal_argument_exception', 'reason': 'Unable to parse [dimension] from provided value [wegerg] for vector [__vector_marqo_knn_field]'}}, 'status': 400}\nPlease create an issue on Marqo's GitHub repo (https://github.com/marqo-ai/marqo/issues) if this problem persists.", 'code': 'unhandled_backend_error', 'type': 'backend_error', 'link': ''}
status_code: 500, type: backend_error, code: unhandled_backend_error, link:

This also may be true for other OpenSearch calls (check add docs, search, etc).

@vicilliar vicilliar added bug Something isn't working good first issue Good for newcomers labels Jul 7, 2023
@a-abhi
Copy link

a-abhi commented Jul 7, 2023

@vicilliar please can you share the version of marqo you are using with current version of marqo the error is not reproducible

Marilena-Andronikou added a commit to Marilena-Andronikou/marqo that referenced this issue Jun 10, 2024
Marilena-Andronikou added a commit to Marilena-Andronikou/marqo that referenced this issue Jun 10, 2024
@Marilena-Andronikou Marilena-Andronikou linked a pull request Jun 10, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants