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] Search API for search all responses generating error #5016

Closed
harshiiash opened this issue May 31, 2024 · 1 comment · Fixed by #5003
Closed

[BUG] Search API for search all responses generating error #5016

harshiiash opened this issue May 31, 2024 · 1 comment · Fixed by #5003
Milestone

Comments

@harshiiash
Copy link

Search API for search all responses generating error

API:
POST: api/v1/datasets/217458ee-de85-4207-b8ea-0d96ac09a96b/records/search?include=responses&include=suggestions&offset=0&limit=10&response_status=submitted

Request Body:
{ "query": {}, "filters": { "and": [ { "type": "terms", "scope": { "entity": "metadata", "metadata_property": "last_modified_by" }, "values": [ "argilla " ] }, { "type": "terms", "scope": { "entity": "response", "question": "relevant" }, "values": [ "THUMBS_UP" ] } ] } }

Response:
{ "detail": { "code": "argilla.api.errors::GenericServerError", "params": { "type": "builtins.AttributeError", "message": "'NoneType' object has no attribute 'id'" } } }

Stacktrace:

ERROR:argilla:'NoneType' object has no attribute 'id' INFO: 192.168.65.1:61489 - "POST /argilla-server/api/v1/datasets/acb8ae8c-ffbc-4a37-b527-becfba90529e/records/search?include=responses&include=suggestions&offset=0&limit=10&response_status=submitted HTTP/1.1" 500 Internal Server Error ERROR: Exception in ASGI application Traceback (most recent call last): File "/opt/venv/lib/python3.10/site-packages/uvicorn/protocols/http/httptools_impl.py", line 426, in run_asgi result = await app( # type: ignore[func-returns-value] File "/opt/venv/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 84, in __call__ return await self.app(scope, receive, send) File "/opt/venv/lib/python3.10/site-packages/fastapi/applications.py", line 1054, in __call__ await super().__call__(scope, receive, send) File "/opt/venv/lib/python3.10/site-packages/starlette/applications.py", line 123, in __call__ await self.middleware_stack(scope, receive, send) File "/opt/venv/lib/python3.10/site-packages/starlette/middleware/errors.py", line 186, in __call__ raise exc File "/opt/venv/lib/python3.10/site-packages/starlette/middleware/errors.py", line 164, in __call__ await self.app(scope, receive, _send) File "/opt/venv/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 65, in __call__ await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) File "/opt/venv/lib/python3.10/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app raise exc File "/opt/venv/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app await app(scope, receive, sender) File "/opt/venv/lib/python3.10/site-packages/starlette/routing.py", line 756, in __call__ await self.middleware_stack(scope, receive, send) File "/opt/venv/lib/python3.10/site-packages/starlette/routing.py", line 776, in app await route.handle(scope, receive, send) File "/opt/venv/lib/python3.10/site-packages/starlette/routing.py", line 485, in handle await self.app(scope, receive, send) File "/opt/venv/lib/python3.10/site-packages/fastapi/applications.py", line 1054, in __call__ await super().__call__(scope, receive, send) File "/opt/venv/lib/python3.10/site-packages/starlette/applications.py", line 123, in __call__ await self.middleware_stack(scope, receive, send) File "/opt/venv/lib/python3.10/site-packages/starlette/middleware/errors.py", line 186, in __call__ raise exc File "/opt/venv/lib/python3.10/site-packages/starlette/middleware/errors.py", line 164, in __call__ await self.app(scope, receive, _send) File "/opt/venv/lib/python3.10/site-packages/brotli_asgi/__init__.py", line 81, in __call__ await responder(scope, receive, send) File "/opt/venv/lib/python3.10/site-packages/brotli_asgi/__init__.py", line 125, in __call__ await self.app(scope, receive, self.send_with_brotli) File "/opt/venv/lib/python3.10/site-packages/starlette/middleware/cors.py", line 93, in __call__ await self.simple_response(scope, receive, send, request_headers=headers) File "/opt/venv/lib/python3.10/site-packages/starlette/middleware/cors.py", line 148, in simple_response await self.app(scope, receive, send) File "/opt/venv/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 65, in __call__ await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) File "/opt/venv/lib/python3.10/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app raise exc File "/opt/venv/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app await app(scope, receive, sender) File "/opt/venv/lib/python3.10/site-packages/starlette/routing.py", line 756, in __call__ await self.middleware_stack(scope, receive, send) File "/opt/venv/lib/python3.10/site-packages/starlette/routing.py", line 776, in app await route.handle(scope, receive, send) File "/opt/venv/lib/python3.10/site-packages/starlette/routing.py", line 485, in handle await self.app(scope, receive, send) File "/opt/venv/lib/python3.10/site-packages/fastapi/applications.py", line 1054, in __call__ await super().__call__(scope, receive, send) File "/opt/venv/lib/python3.10/site-packages/starlette/applications.py", line 123, in __call__ await self.middleware_stack(scope, receive, send) File "/opt/venv/lib/python3.10/site-packages/starlette/middleware/errors.py", line 186, in __call__ raise exc File "/opt/venv/lib/python3.10/site-packages/starlette/middleware/errors.py", line 164, in __call__ await self.app(scope, receive, _send) File "/opt/venv/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 65, in __call__ await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) File "/opt/venv/lib/python3.10/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app raise exc File "/opt/venv/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app await app(scope, receive, sender) File "/opt/venv/lib/python3.10/site-packages/starlette/routing.py", line 756, in __call__ await self.middleware_stack(scope, receive, send) File "/opt/venv/lib/python3.10/site-packages/starlette/routing.py", line 776, in app await route.handle(scope, receive, send) File "/opt/venv/lib/python3.10/site-packages/starlette/routing.py", line 297, in handle await self.app(scope, receive, send) File "/opt/venv/lib/python3.10/site-packages/starlette/routing.py", line 77, in app await wrap_app_handling_exceptions(app, request)(scope, receive, send) File "/opt/venv/lib/python3.10/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app raise exc File "/opt/venv/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app await app(scope, receive, sender) File "/opt/venv/lib/python3.10/site-packages/starlette/routing.py", line 72, in app response = await func(request) File "/opt/venv/lib/python3.10/site-packages/fastapi/routing.py", line 278, in app raw_response = await run_endpoint_function( File "/opt/venv/lib/python3.10/site-packages/fastapi/routing.py", line 191, in run_endpoint_function return await dependant.call(**values) File "/opt/venv/lib/python3.10/site-packages/argilla_server/apis/v1/handlers/datasets/records.py", line 634, in search_dataset_records search_responses = await _get_search_responses( File "/opt/venv/lib/python3.10/site-packages/argilla_server/apis/v1/handlers/datasets/records.py", line 272, in _get_search_responses return await search_engine.search(**search_params) File "/opt/venv/lib/python3.10/site-packages/argilla_server/search_engine/commons.py", line 591, in search bool_query["filter"] = self.build_elasticsearch_filter(filter) File "/opt/venv/lib/python3.10/site-packages/argilla_server/search_engine/commons.py", line 435, in build_elasticsearch_filter filters = [self.build_elasticsearch_filter(f) for f in filter.filters] File "/opt/venv/lib/python3.10/site-packages/argilla_server/search_engine/commons.py", line 435, in <listcomp> filters = [self.build_elasticsearch_filter(f) for f in filter.filters] File "/opt/venv/lib/python3.10/site-packages/argilla_server/search_engine/commons.py", line 435, in build_elasticsearch_filter filters = [self.build_elasticsearch_filter(f) for f in filter.filters] File "/opt/venv/lib/python3.10/site-packages/argilla_server/search_engine/commons.py", line 435, in <listcomp> filters = [self.build_elasticsearch_filter(f) for f in filter.filters] File "/opt/venv/lib/python3.10/site-packages/argilla_server/search_engine/commons.py", line 445, in build_elasticsearch_filter es_field = self._scope_to_elasticsearch_field(filter.scope) File "/opt/venv/lib/python3.10/site-packages/argilla_server/search_engine/commons.py", line 470, in _scope_to_elasticsearch_field return es_field_for_response_value(scope.user, question=scope.question) File "/opt/venv/lib/python3.10/site-packages/argilla_server/search_engine/commons.py", line 108, in es_field_for_response_value return f"responses.{es_path_for_user(user)}.values.{question}" File "/opt/venv/lib/python3.10/site-packages/argilla_server/search_engine/commons.py", line 196, in es_path_for_user return str(user.id) AttributeError: 'NoneType' object has no attribute 'id'

@frascuchon frascuchon transferred this issue from argilla-io/argilla-server Jun 14, 2024
@frascuchon frascuchon linked a pull request Jun 14, 2024 that will close this issue
10 tasks
@frascuchon frascuchon added this to the v2.0.0 milestone Jun 14, 2024
@frascuchon
Copy link
Member

Fixed by #5003

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants