[š Bug]: Viewing alert in workflow results in 500 Internal Server Error
Describe the bug Backend fails with multiple critical errors:
- Clicking an alert from a workflow view causes HTTP
500 Internal Server Error. - Logs show several SQL errors
To Reproduce Steps to reproduce the behavior:
- Go to
Workflows - Select a workflow
- Click any associated alert
- Observe
500error
Expected behavior
- Alert view should load without exception
- Errors must be handled without crashing the backend
Screenshots N/A
Additional context
Keep Version: 0.46.1
Build: 321e50
Database: Postgres 17.5
Logs
2025-07-21T08:44:17.695914447Z {"worker_type": "uvicorn", "asctime": "2025-07-21 08:44:17,695", "message": "An unhandled exception occurred: (psycopg2.errors.InvalidTextRepresentation) invalid input syntax for type uuid: \"73113e984a14fc4d\"\nLINE 6: ...01T00:00:00'::timestamp) AND lastalert.alert_id = '73113e984...\n ^\n\n[SQL: SELECT count(%(count_2)s) AS count_1 \nFROM lastalert JOIN alert ON alert.id = lastalert.alert_id AND alert.tenant_id = lastalert.tenant_id LEFT OUTER JOIN alertenrichment ON lastalert.tenant_id = alertenrichment.tenant_id AND lastalert.fingerprint = alertenrichment.alert_fingerprint \nWHERE lastalert.tenant_id = %(tenant_id_1)s AND lastalert.timestamp >= coalesce((SELECT lastalert.timestamp \nFROM lastalert \nWHERE lastalert.tenant_id = %(tenant_id_2)s ORDER BY lastalert.timestamp DESC \n LIMIT %(param_1)s OFFSET %(param_2)s), %(coalesce_1)s) AND lastalert.alert_id = '73113e984a14fc4d' /*db_driver='psycopg2',db_framework='sqlalchemy%%3A2.0.36',traceparent='00-d6264c06423574d00aae4f3cba2f771c-dd20374830c45113-01'*/]\n[parameters: {'count_2': 1, 'tenant_id_1': 'keep', 'tenant_id_2': 'keep', 'param_1': 1, 'param_2': 49999, 'coalesce_1': datetime.datetime(1, 1, 1, 0, 0)}]\n(Background on this error at: https://sqlalche.me/e/20/9h9h), Trace ID: d6264c06423574d00aae4f3cba2f771c. Tenant ID: None", "levelname": "ERROR", "name": "root", "filename": "api.py", "otelTraceID": "0", "otelSpanID": "0", "otelTraceSampled": false, "otelServiceName": "keep-api", "threadName": "MainThread", "process": 24, "module": "api", "taskName": "Task-46636"}
2025-07-21T08:44:17.695922574Z 2025-07-21 08:44:17,695 - 0 - MainThread - 10.244.9.68:59174 - "POST /alerts/query HTTP/1.1" 500
2025-07-21T08:44:17.706780002Z {"worker_type": "uvicorn", "asctime": "2025-07-21 08:44:17,695", "message": "Exception in ASGI application\n", "levelname": "ERROR", "name": "uvicorn.error", "filename": "httptools_impl.py", "otelTraceID": "0", "otelSpanID": "0", "otelTraceSampled": false, "otelServiceName": "keep-api", "threadName": "MainThread", "process": 24, "module": "httptools_impl", "exc_info": "Traceback (most recent call last):\n File \"/venv/lib/python3.13/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n ~~~~~~~~~~~~~~~~~~~~~~~^\n cursor, str_statement, effective_parameters, context\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n )\n ^\n File \"/venv/lib/python3.13/site-packages/sqlalchemy/engine/default.py\", line 941, in do_execute\n cursor.execute(statement, parameters)\n ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^\npsycopg2.errors.InvalidTextRepresentation: invalid input syntax for type uuid: \"73113e984a14fc4d\"\nLINE 6: ...01T00:00:00'::timestamp) AND lastalert.alert_id = '73113e984...\n ^\n\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/venv/lib/python3.13/site-packages/uvicorn/protocols/http/httptools_impl.py\", line 409, in run_asgi\n result = await app( # type: ignore[func-returns-value]\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n self.scope, self.receive, self.send\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n )\n ^\n File \"/venv/lib/python3.13/site-packages/uvicorn/middleware/proxy_headers.py\", line 60, in __call__\n return await self.app(scope, receive, send)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/venv/lib/python3.13/site-packages/fastapi/applications.py\", line 1054, in __call__\n await super().__call__(scope, receive, send)\n File \"/venv/lib/python3.13/site-packages/starlette/applications.py\", line 113, in __call__\n await self.middleware_stack(scope, receive, send)\n File \"/venv/lib/python3.13/site-packages/starlette/middleware/errors.py\", line 187, in __call__\n raise exc\n File \"/venv/lib/python3.13/site-packages/starlette/middleware/errors.py\", line 165, in __call__\n await self.app(scope, receive, _send)\n File \"/venv/lib/python3.13/site-packages/opentelemetry/instrumentation/asgi/__init__.py\", line 743, in __call__\n await self.app(scope, otel_receive, otel_send)\n File \"/venv/lib/python3.13/site-packages/starlette/middleware/base.py\", line 185, in __call__\n with collapse_excgroups():\n ~~~~~~~~~~~~~~~~~~^^\n File \"/usr/local/lib/python3.13/contextlib.py\", line 162, in __exit__\n self.gen.throw(value)\n ~~~~~~~~~~~~~~^^^^^^^\n File \"/venv/lib/python3.13/site-packages/starlette/_utils.py\", line 82, in collapse_excgroups\n raise exc\n File \"/venv/lib/python3.13/site-packages/starlette/middleware/base.py\", line 187, in __call__\n response = await self.dispatch_func(request, call_next)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/venv/lib/python3.13/site-packages/keep/api/observability.py\", line 107, in __call__\n response = await call_next(request)\n ^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/venv/lib/python3.13/site-packages/starlette/middleware/base.py\", line 163, in call_next\n raise app_exc\n File \"/venv/lib/python3.13/site-packages/starlette/middleware/base.py\", line 149, in coro\n await self.app(scope, receive_or_disconnect, send_no_error)\n File \"/venv/lib/python3.13/site-packages/prometheus_fastapi_instrumentator/middleware.py\", line 174, in __call__\n raise exc\n File \"/venv/lib/python3.13/site-packages/prometheus_fastapi_instrumentator/middleware.py\", line 172, in __call__\n await self.app(scope, receive, send_wrapper)\n File \"/venv/lib/python3.13/site-packages/starlette/middleware/base.py\", line 185, in __call__\n with collapse_excgroups():\n ~~~~~~~~~~~~~~~~~~^^\n File \"/usr/local/lib/python3.13/contextlib.py\", line 162, in __exit__\n self.gen.throw(value)\n ~~~~~~~~~~~~~~^^^^^^^\n File \"/venv/lib/python3.13/site-packages/starlette/_utils.py\", line 82, in collapse_excgroups\n raise exc\n File \"/venv/lib/python3.13/site-packages/starlette/middleware/base.py\", line 187, in __call__\n response = await self.dispatch_func(request, call_next)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/venv/lib/python3.13/site-packages/keep/api/middlewares.py\", line 60, in dispatch\n response = await call_next(request)\n ^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/venv/lib/python3.13/site-packages/starlette/middleware/base.py\", line 163, in call_next\n raise app_exc\n File \"/venv/lib/python3.13/site-packages/starlette/middleware/base.py\", line 149, in coro\n await self.app(scope, receive_or_disconnect, send_no_error)\n File \"/venv/lib/python3.13/site-packages/starlette/middleware/cors.py\", line 93, in __call__\n await self.simple_response(scope, receive, send, request_headers=headers)\n File \"/venv/lib/python3.13/site-packages/starlette/middleware/cors.py\", line 144, in simple_response\n await self.app(scope, receive, send)\n File \"/venv/lib/python3.13/site-packages/starlette/middleware/gzip.py\", line 20, in __call__\n await responder(scope, receive, send)\n File \"/venv/lib/python3.13/site-packages/starlette/middleware/gzip.py\", line 39, in __call__\n await self.app(scope, receive, self.send_with_gzip)\n File \"/venv/lib/python3.13/site-packages/starlette_context/middleware/raw_middleware.py\", line 92, in __call__\n await self.app(scope, receive, send_wrapper)\n File \"/venv/lib/python3.13/site-packages/starlette/middleware/exceptions.py\", line 62, in __call__\n await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)\n File \"/venv/lib/python3.13/site-packages/starlette/_exception_handler.py\", line 53, in wrapped_app\n raise exc\n File \"/venv/lib/python3.13/site-packages/starlette/_exception_handler.py\", line 42, in wrapped_app\n await app(scope, receive, sender)\n File \"/venv/lib/python3.13/site-packages/starlette/routing.py\", line 715, in __call__\n await self.middleware_stack(scope, receive, send)\n File \"/venv/lib/python3.13/site-packages/starlette/routing.py\", line 735, in app\n await route.handle(scope, receive, send)\n File \"/venv/lib/python3.13/site-packages/starlette/routing.py\", line 288, in handle\n await self.app(scope, receive, send)\n File \"/venv/lib/python3.13/site-packages/starlette/routing.py\", line 76, in app\n await wrap_app_handling_exceptions(app, request)(scope, receive, send)\n File \"/venv/lib/python3.13/site-packages/starlette/_exception_handler.py\", line 53, in wrapped_app\n raise exc\n File \"/venv/lib/python3.13/site-packages/starlette/_exception_handler.py\", line 42, in wrapped_app\n await app(scope, receive, sender)\n File \"/venv/lib/python3.13/site-packages/starlette/routing.py\", line 73, in app\n response = await f(request)\n ^^^^^^^^^^^^^^^^\n File \"/venv/lib/python3.13/site-packages/fastapi/routing.py\", line 301, in app\n raw_response = await run_endpoint_function(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n ...<3 lines>...\n )\n ^\n File \"/venv/lib/python3.13/site-packages/fastapi/routing.py\", line 214, in run_endpoint_function\n return await run_in_threadpool(dependant.call, **values)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/venv/lib/python3.13/site-packages/starlette/concurrency.py\", line 39, in run_in_threadpool\n return await anyio.to_thread.run_sync(func, *args)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/venv/lib/python3.13/site-packages/anyio/to_thread.py\", line 56, in run_sync\n return await get_async_backend().run_sync_in_worker_thread(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n func, args, abandon_on_cancel=abandon_on_cancel, limiter=limiter\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n )\n ^\n File \"/venv/lib/python3.13/site-packages/anyio/_backends/_asyncio.py\", line 2505, in run_sync_in_worker_thread\n return await future\n ^^^^^^^^^^^^\n File \"/venv/lib/python3.13/site-packages/anyio/_backends/_asyncio.py\", line 1005, in run\n result = context.run(func, *args)\n File \"/venv/lib/python3.13/site-packages/keep/api/routes/alerts.py\", line 225, in query_alerts\n db_alerts, total_count = query_last_alerts(tenant_id=tenant_id, query=query)\n ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/venv/lib/python3.13/site-packages/keep/api/core/alerts.py\", line 386, in query_last_alerts\n total_count = session.exec(total_count_query).one()[0]\n ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^\n File \"/venv/lib/python3.13/site-packages/sqlmodel/orm/session.py\", line 66, in exec\n results = super().execute(\n statement,\n ...<4 lines>...\n _add_event=_add_event,\n )\n File \"/venv/lib/python3.13/site-packages/sqlalchemy/orm/session.py\", line 2362, in execute\n return self._execute_internal(\n ~~~~~~~~~~~~~~~~~~~~~~^\n statement,\n ^^^^^^^^^^\n ...<4 lines>...\n _add_event=_add_event,\n ^^^^^^^^^^^^^^^^^^^^^^\n )\n ^\n File \"/venv/lib/python3.13/site-packages/sqlalchemy/orm/session.py\", line 2247, in _execute_internal\n result: Result[Any] = compile_state_cls.orm_execute_statement(\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^\n self,\n ^^^^^\n ...<4 lines>...\n conn,\n ^^^^^\n )\n ^\n File \"/venv/lib/python3.13/site-packages/sqlalchemy/orm/context.py\", line 305, in orm_execute_statement\n result = conn.execute(\n statement, params or {}, execution_options=execution_options\n )\n File \"/venv/lib/python3.13/site-packages/sqlalchemy/engine/base.py\", line 1418, in execute\n return meth(\n self,\n distilled_parameters,\n execution_options or NO_OPTIONS,\n )\n File \"/venv/lib/python3.13/site-packages/sqlalchemy/sql/elements.py\", line 515, in _execute_on_connection\n return connection._execute_clauseelement(\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^\n self, distilled_params, execution_options\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n )\n ^\n File \"/venv/lib/python3.13/site-packages/sqlalchemy/engine/base.py\", line 1640, in _execute_clauseelement\n ret = self._execute_context(\n dialect,\n ...<8 lines>...\n cache_hit=cache_hit,\n )\n File \"/venv/lib/python3.13/site-packages/sqlalchemy/engine/base.py\", line 1846, in _execute_context\n return self._exec_single_context(\n ~~~~~~~~~~~~~~~~~~~~~~~~~^\n dialect, context, statement, parameters\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n )\n ^\n File \"/venv/lib/python3.13/site-packages/sqlalchemy/engine/base.py\", line 1986, in _exec_single_context\n self._handle_dbapi_exception(\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^\n e, str_statement, effective_parameters, cursor, context\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n )\n ^\n File \"/venv/lib/python3.13/site-packages/sqlalchemy/engine/base.py\", line 2355, in _handle_dbapi_exception\n raise sqlalchemy_exception.with_traceback(exc_info[2]) from e\n File \"/venv/lib/python3.13/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n ~~~~~~~~~~~~~~~~~~~~~~~^\n cursor, str_statement, effective_parameters, context\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n )\n ^\n File \"/venv/lib/python3.13/site-packages/sqlalchemy/engine/default.py\", line 941, in do_execute\n cursor.execute(statement, parameters)\n ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^\nsqlalchemy.exc.DataError: (psycopg2.errors.InvalidTextRepresentation) invalid input syntax for type uuid: \"73113e984a14fc4d\"\nLINE 6: ...01T00:00:00'::timestamp) AND lastalert.alert_id = '73113e984...\n ^\n\n[SQL: SELECT count(%(count_2)s) AS count_1 \nFROM lastalert JOIN alert ON alert.id = lastalert.alert_id AND alert.tenant_id = lastalert.tenant_id LEFT OUTER JOIN alertenrichment ON lastalert.tenant_id = alertenrichment.tenant_id AND lastalert.fingerprint = alertenrichment.alert_fingerprint \nWHERE lastalert.tenant_id = %(tenant_id_1)s AND lastalert.timestamp >= coalesce((SELECT lastalert.timestamp \nFROM lastalert \nWHERE lastalert.tenant_id = %(tenant_id_2)s ORDER BY lastalert.timestamp DESC \n LIMIT %(param_1)s OFFSET %(param_2)s), %(coalesce_1)s) AND lastalert.alert_id = '73113e984a14fc4d' /*db_driver='psycopg2',db_framework='sqlalchemy%%3A2.0.36',traceparent='00-d6264c06423574d00aae4f3cba2f771c-dd20374830c45113-01'*/]\n[parameters: {'count_2': 1, 'tenant_id_1': 'keep', 'tenant_id_2': 'keep', 'param_1': 1, 'param_2': 49999, 'coalesce_1': datetime.datetime(1, 1, 1, 0, 0)}]\n(Background on this error at: https://sqlalche.me/e/20/9h9h)", "taskName": "Task-46636"}
2025-07-21T08:44:17.742581017Z {"worker_type": "uvicorn", "asctime": "2025-07-21 08:44:17,742", "message": "An unhandled exception occurred: (psycopg2.errors.InvalidTextRepresentation) invalid input syntax for type uuid: \"73113e984a14fc4d\"\nLINE 6: ...01T00:00:00'::timestamp) AND lastalert.alert_id = '73113e984...\n ^\n\n[SQL: (SELECT %(param_1)s AS facet_id, coalesce((alertenrichment.enrichments) ->> 'severity', (alert.event) ->> 'severity') AS facet_value, count(distinct(lastalert.alert_id)) AS matches_count \nFROM lastalert JOIN alert ON alert.id = lastalert.alert_id AND alert.tenant_id = lastalert.tenant_id LEFT OUTER JOIN alertenrichment ON lastalert.tenant_id = alertenrichment.tenant_id AND lastalert.fingerprint = alertenrichment.alert_fingerprint \nWHERE lastalert.tenant_id = %(tenant_id_1)s AND lastalert.timestamp >= coalesce((SELECT lastalert.timestamp \nFROM lastalert \nWHERE lastalert.tenant_id = %(tenant_id_2)s ORDER BY lastalert.timestamp DESC \n LIMIT %(param_2)s OFFSET %(param_3)s), %(coalesce_1)s) AND lastalert.alert_id = '73113e984a14fc4d' GROUP BY facet_id, facet_value \n LIMIT %(param_4)s) UNION ALL (SELECT %(param_5)s AS facet_id, coalesce((alertenrichment.enrichments) ->> 'status', (alert.event) ->> 'status') AS facet_value, count(distinct(lastalert.alert_id)) AS matches_count \nFROM lastalert JOIN alert ON alert.id = lastalert.alert_id AND alert.tenant_id = lastalert.tenant_id LEFT OUTER JOIN alertenrichment ON lastalert.tenant_id = alertenrichment.tenant_id AND lastalert.fingerprint = alertenrichment.alert_fingerprint \nWHERE lastalert.tenant_id = %(tenant_id_3)s AND lastalert.timestamp >= coalesce((SELECT lastalert.timestamp \nFROM lastalert \nWHERE lastalert.tenant_id = %(tenant_id_4)s ORDER BY lastalert.timestamp DESC \n LIMIT %(param_6)s OFFSET %(param_7)s), %(coalesce_2)s) AND lastalert.alert_id = '73113e984a14fc4d' GROUP BY facet_id, facet_value \n LIMIT %(param_8)s) UNION ALL (SELECT %(param_9)s AS facet_id, CAST(alert.provider_type AS VARCHAR) AS facet_value, count(distinct(lastalert.alert_id)) AS matches_count \nFROM lastalert JOIN alert ON alert.id = lastalert.alert_id AND alert.tenant_id = lastalert.tenant_id LEFT OUTER JOIN alertenrichment ON lastalert.tenant_id = alertenrichment.tenant_id AND lastalert.fingerprint = alertenrichment.alert_fingerprint \nWHERE lastalert.tenant_id = %(tenant_id_5)s AND lastalert.timestamp >= coalesce((SELECT lastalert.timestamp \nFROM lastalert \nWHERE lastalert.tenant_id = %(tenant_id_6)s ORDER BY lastalert.timestamp DESC \n LIMIT %(param_10)s OFFSET %(param_11)s), %(coalesce_3)s) AND lastalert.alert_id = '73113e984a14fc4d' GROUP BY facet_id, facet_value \n LIMIT %(param_12)s) UNION ALL (SELECT %(param_13)s AS facet_id, CAST(coalesce(incident.user_generated_name, incident.ai_generated_name) AS VARCHAR) AS facet_value, count(distinct(lastalert.alert_id)) AS matches_count \nFROM lastalert JOIN alert ON alert.id = lastalert.alert_id AND alert.tenant_id = lastalert.tenant_id LEFT OUTER JOIN alertenrichment ON lastalert.tenant_id = alertenrichment.tenant_id AND lastalert.fingerprint = alertenrichment.alert_fingerprint LEFT OUTER JOIN lastalerttoincident ON lastalert.tenant_id = lastalerttoincident.tenant_id AND lastalert.fingerprint = lastalerttoincident.fingerprint LEFT OUTER JOIN incident ON lastalerttoincident.tenant_id = incident.tenant_id AND lastalerttoincident.incident_id = incident.id AND incident.status = %(status_1)s \nWHERE lastalert.tenant_id = %(tenant_id_7)s AND lastalert.timestamp >= coalesce((SELECT lastalert.timestamp \nFROM lastalert \nWHERE lastalert.tenant_id = %(tenant_id_8)s ORDER BY lastalert.timestamp DESC \n LIMIT %(param_14)s OFFSET %(param_15)s), %(coalesce_4)s) AND lastalert.alert_id = '73113e984a14fc4d' GROUP BY facet_id, facet_value \n LIMIT %(param_16)s) UNION ALL (SELECT %(param_17)s AS facet_id, CASE WHEN (lower((alertenrichment.enrichments) ->> 'dismissed') = %(lower_1)s) THEN %(param_18)s WHEN (lower((alertenrichment.enrichments) ->> 'dismissed') = %(lower_2)s) THEN %(param_19)s WHEN ((alertenrichment.enrichments) ->> 'dismissed' ~ %(alertenrichment_enrichments_->>_'dismissed'_1)s) THEN CASE WHEN (CAST((alertenrichment.enrichments) ->> 'dismissed' AS INTEGER) >= %(param_20)s) THEN %(param_21)s ELSE %(param_22)s END WHEN ((alertenrichment.enrichments) ->> 'dismissed' != %(alertenrichment_enrichments_->>_'dismissed'_2)s) THEN %(param_23)s ELSE %(param_24)s END AS facet_value, count(distinct(lastalert.alert_id)) AS matches_count \nFROM lastalert JOIN alert ON alert.id = lastalert.alert_id AND alert.tenant_id = lastalert.tenant_id LEFT OUTER JOIN alertenrichment ON lastalert.tenant_id = alertenrichment.tenant_id AND lastalert.fingerprint = alertenrichment.alert_fingerprint \nWHERE lastalert.tenant_id = %(tenant_id_9)s AND lastalert.timestamp >= coalesce((SELECT lastalert.timestamp \nFROM lastalert \nWHERE lastalert.tenant_id = %(tenant_id_10)s ORDER BY lastalert.timestamp DESC \n LIMIT %(param_25)s OFFSET %(param_26)s), %(coalesce_5)s) AND lastalert.alert_id = '73113e984a14fc4d' GROUP BY facet_id, facet_value \n LIMIT %(param_27)s) /*db_driver='psycopg2',db_framework='sqlalchemy%%3A2.0.36',traceparent='00-ac060a29daa99594159b42db980caa97-4e1455ce4385de19-01'*/]\n[parameters: {'param_1': 'severity5eaf5f8bd091a5201757b40ff3fd07e02d7bd509', 'tenant_id_1': 'keep', 'tenant_id_2': 'keep', 'param_2': 1, 'param_3': 49999, 'coalesce_1': datetime.datetime(1, 1, 1, 0, 0), 'param_4': 50, 'param_5': 'status5eaf5f8bd091a5201757b40ff3fd07e02d7bd509', 'tenant_id_3': 'keep', 'tenant_id_4': 'keep', 'param_6': 1, 'param_7': 49999, 'coalesce_2': datetime.datetime(1, 1, 1, 0, 0), 'param_8': 50, 'param_9': 'source5eaf5f8bd091a5201757b40ff3fd07e02d7bd509', 'tenant_id_5': 'keep', 'tenant_id_6': 'keep', 'param_10': 1, 'param_11': 49999, 'coalesce_3': datetime.datetime(1, 1, 1, 0, 0), 'param_12': 50, 'param_13': 'incident.name5eaf5f8bd091a5201757b40ff3fd07e02d7bd509', 'status_1': 'firing', 'tenant_id_7': 'keep', 'tenant_id_8': 'keep', 'param_14': 1, 'param_15': 49999, 'coalesce_4': datetime.datetime(1, 1, 1, 0, 0), 'param_16': 50, 'param_17': 'dismissed5eaf5f8bd091a5201757b40ff3fd07e02d7bd509', 'lower_1': 'true', 'param_18': 'true', 'lower_2': 'false', 'param_19': 'false', \"alertenrichment_enrichments_->>_'dismissed'_1\": '^[0-9]+$', 'param_20': 1, 'param_21': 'true', 'param_22': 'false', \"alertenrichment_enrichments_->>_'dismissed'_2\": '', 'param_23': 'true', 'param_24': 'false', 'tenant_id_9': 'keep', 'tenant_id_10': 'keep', 'param_25': 1, 'param_26': 49999, 'coalesce_5': datetime.datetime(1, 1, 1, 0, 0), 'param_27': 50}]\n(Background on this error at: https://sqlalche.me/e/20/9h9h), Trace ID: ac060a29daa99594159b42db980caa97. Tenant ID: None", "levelname": "ERROR", "name": "root", "filename": "api.py", "otelTraceID": "0", "otelSpanID": "0", "otelTraceSampled": false, "otelServiceName": "keep-api", "threadName": "MainThread", "process": 19, "module": "api", "taskName": "Task-13269"}
2025-07-21T08:44:17.742824726Z 2025-07-21 08:44:17,742 - 0 - MainThread - 10.244.9.68:59160 - "POST /alerts/facets/options HTTP/1.1" 500
2025-07-21T08:44:17.754915012Z {"worker_type": "uvicorn", "asctime": "2025-07-21 08:44:17,742", "message": "Exception in ASGI application\n", "levelname": "ERROR", "name": "uvicorn.error", "filename": "httptools_impl.py", "otelTraceID": "0", "otelSpanID": "0", "otelTraceSampled": false, "otelServiceName": "keep-api", "threadName": "MainThread", "process": 19, "module": "httptools_impl", "exc_info": "Traceback (most recent call last):\n File \"/venv/lib/python3.13/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n ~~~~~~~~~~~~~~~~~~~~~~~^\n cursor, str_statement, effective_parameters, context\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n )\n ^\n File \"/venv/lib/python3.13/site-packages/sqlalchemy/engine/default.py\", line 941, in do_execute\n cursor.execute(statement, parameters)\n ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^\npsycopg2.errors.InvalidTextRepresentation: invalid input syntax for type uuid: \"73113e984a14fc4d\"\nLINE 6: ...01T00:00:00'::timestamp) AND lastalert.alert_id = '73113e984...\n ^\n\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/venv/lib/python3.13/site-packages/uvicorn/protocols/http/httptools_impl.py\", line 409, in run_asgi\n result = await app( # type: ignore[func-returns-value]\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n self.scope, self.receive, self.send\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n )\n ^\n File \"/venv/lib/python3.13/site-packages/uvicorn/middleware/proxy_headers.py\", line 60, in __call__\n return await self.app(scope, receive, send)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/venv/lib/python3.13/site-packages/fastapi/applications.py\", line 1054, in __call__\n await super().__call__(scope, receive, send)\n File \"/venv/lib/python3.13/site-packages/starlette/applications.py\", line 113, in __call__\n await self.middleware_stack(scope, receive, send)\n File \"/venv/lib/python3.13/site-packages/starlette/middleware/errors.py\", line 187, in __call__\n raise exc\n File \"/venv/lib/python3.13/site-packages/starlette/middleware/errors.py\", line 165, in __call__\n await self.app(scope, receive, _send)\n File \"/venv/lib/python3.13/site-packages/opentelemetry/instrumentation/asgi/__init__.py\", line 743, in __call__\n await self.app(scope, otel_receive, otel_send)\n File \"/venv/lib/python3.13/site-packages/starlette/middleware/base.py\", line 185, in __call__\n with collapse_excgroups():\n ~~~~~~~~~~~~~~~~~~^^\n File \"/usr/local/lib/python3.13/contextlib.py\", line 162, in __exit__\n self.gen.throw(value)\n ~~~~~~~~~~~~~~^^^^^^^\n File \"/venv/lib/python3.13/site-packages/starlette/_utils.py\", line 82, in collapse_excgroups\n raise exc\n File \"/venv/lib/python3.13/site-packages/starlette/middleware/base.py\", line 187, in __call__\n response = await self.dispatch_func(request, call_next)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/venv/lib/python3.13/site-packages/keep/api/observability.py\", line 107, in __call__\n response = await call_next(request)\n ^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/venv/lib/python3.13/site-packages/starlette/middleware/base.py\", line 163, in call_next\n raise app_exc\n File \"/venv/lib/python3.13/site-packages/starlette/middleware/base.py\", line 149, in coro\n await self.app(scope, receive_or_disconnect, send_no_error)\n File \"/venv/lib/python3.13/site-packages/prometheus_fastapi_instrumentator/middleware.py\", line 174, in __call__\n raise exc\n File \"/venv/lib/python3.13/site-packages/prometheus_fastapi_instrumentator/middleware.py\", line 172, in __call__\n await self.app(scope, receive, send_wrapper)\n File \"/venv/lib/python3.13/site-packages/starlette/middleware/base.py\", line 185, in __call__\n with collapse_excgroups():\n ~~~~~~~~~~~~~~~~~~^^\n File \"/usr/local/lib/python3.13/contextlib.py\", line 162, in __exit__\n self.gen.throw(value)\n ~~~~~~~~~~~~~~^^^^^^^\n File \"/venv/lib/python3.13/site-packages/starlette/_utils.py\", line 82, in collapse_excgroups\n raise exc\n File \"/venv/lib/python3.13/site-packages/starlette/middleware/base.py\", line 187, in __call__\n response = await self.dispatch_func(request, call_next)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/venv/lib/python3.13/site-packages/keep/api/middlewares.py\", line 60, in dispatch\n response = await call_next(request)\n ^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/venv/lib/python3.13/site-packages/starlette/middleware/base.py\", line 163, in call_next\n raise app_exc\n File \"/venv/lib/python3.13/site-packages/starlette/middleware/base.py\", line 149, in coro\n await self.app(scope, receive_or_disconnect, send_no_error)\n File \"/venv/lib/python3.13/site-packages/starlette/middleware/cors.py\", line 93, in __call__\n await self.simple_response(scope, receive, send, request_headers=headers)\n File \"/venv/lib/python3.13/site-packages/starlette/middleware/cors.py\", line 144, in simple_response\n await self.app(scope, receive, send)\n File \"/venv/lib/python3.13/site-packages/starlette/middleware/gzip.py\", line 20, in __call__\n await responder(scope, receive, send)\n File \"/venv/lib/python3.13/site-packages/starlette/middleware/gzip.py\", line 39, in __call__\n await self.app(scope, receive, self.send_with_gzip)\n File \"/venv/lib/python3.13/site-packages/starlette_context/middleware/raw_middleware.py\", line 92, in __call__\n await self.app(scope, receive, send_wrapper)\n File \"/venv/lib/python3.13/site-packages/starlette/middleware/exceptions.py\", line 62, in __call__\n await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)\n File \"/venv/lib/python3.13/site-packages/starlette/_exception_handler.py\", line 53, in wrapped_app\n raise exc\n File \"/venv/lib/python3.13/site-packages/starlette/_exception_handler.py\", line 42, in wrapped_app\n await app(scope, receive, sender)\n File \"/venv/lib/python3.13/site-packages/starlette/routing.py\", line 715, in __call__\n await self.middleware_stack(scope, receive, send)\n File \"/venv/lib/python3.13/site-packages/starlette/routing.py\", line 735, in app\n await route.handle(scope, receive, send)\n File \"/venv/lib/python3.13/site-packages/starlette/routing.py\", line 288, in handle\n await self.app(scope, receive, send)\n File \"/venv/lib/python3.13/site-packages/starlette/routing.py\", line 76, in app\n await wrap_app_handling_exceptions(app, request)(scope, receive, send)\n File \"/venv/lib/python3.13/site-packages/starlette/_exception_handler.py\", line 53, in wrapped_app\n raise exc\n File \"/venv/lib/python3.13/site-packages/starlette/_exception_handler.py\", line 42, in wrapped_app\n await app(scope, receive, sender)\n File \"/venv/lib/python3.13/site-packages/starlette/routing.py\", line 73, in app\n response = await f(request)\n ^^^^^^^^^^^^^^^^\n File \"/venv/lib/python3.13/site-packages/fastapi/routing.py\", line 301, in app\n raw_response = await run_endpoint_function(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n ...<3 lines>...\n )\n ^\n File \"/venv/lib/python3.13/site-packages/fastapi/routing.py\", line 214, in run_endpoint_function\n return await run_in_threadpool(dependant.call, **values)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/venv/lib/python3.13/site-packages/starlette/concurrency.py\", line 39, in run_in_threadpool\n return await anyio.to_thread.run_sync(func, *args)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/venv/lib/python3.13/site-packages/anyio/to_thread.py\", line 56, in run_sync\n return await get_async_backend().run_sync_in_worker_thread(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n func, args, abandon_on_cancel=abandon_on_cancel, limiter=limiter\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n )\n ^\n File \"/venv/lib/python3.13/site-packages/anyio/_backends/_asyncio.py\", line 2505, in run_sync_in_worker_thread\n return await future\n ^^^^^^^^^^^^\n File \"/venv/lib/python3.13/site-packages/anyio/_backends/_asyncio.py\", line 1005, in run\n result = context.run(func, *args)\n File \"/venv/lib/python3.13/site-packages/keep/api/routes/alerts.py\", line 114, in fetch_alert_facet_options\n facet_options = get_alert_facets_data(\n tenant_id=tenant_id, facet_options_query=facet_options_query\n )\n File \"/venv/lib/python3.13/site-packages/keep/api/core/alerts.py\", line 450, in get_alert_facets_data\n return get_facet_options(\n base_query_factory=base_query_factory,\n ...<3 lines>...\n properties_metadata=properties_metadata,\n )\n File \"/venv/lib/python3.13/site-packages/keep/api/core/facets.py\", line 99, in get_facet_options\n data = session.exec(db_query).all()\n ~~~~~~~~~~~~^^^^^^^^^^\n File \"/venv/lib/python3.13/site-packages/sqlmodel/orm/session.py\", line 66, in exec\n results = super().execute(\n statement,\n ...<4 lines>...\n _add_event=_add_event,\n )\n File \"/venv/lib/python3.13/site-packages/sqlalchemy/orm/session.py\", line 2362, in execute\n return self._execute_internal(\n ~~~~~~~~~~~~~~~~~~~~~~^\n statement,\n ^^^^^^^^^^\n ...<4 lines>...\n _add_event=_add_event,\n ^^^^^^^^^^^^^^^^^^^^^^\n )\n ^\n File \"/venv/lib/python3.13/site-packages/sqlalchemy/orm/session.py\", line 2247, in _execute_internal\n result: Result[Any] = compile_state_cls.orm_execute_statement(\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^\n self,\n ^^^^^\n ...<4 lines>...\n conn,\n ^^^^^\n )\n ^\n File \"/venv/lib/python3.13/site-packages/sqlalchemy/orm/context.py\", line 305, in orm_execute_statement\n result = conn.execute(\n statement, params or {}, execution_options=execution_options\n )\n File \"/venv/lib/python3.13/site-packages/sqlalchemy/engine/base.py\", line 1418, in execute\n return meth(\n self,\n distilled_parameters,\n execution_options or NO_OPTIONS,\n )\n File \"/venv/lib/python3.13/site-packages/sqlalchemy/sql/elements.py\", line 515, in _execute_on_connection\n return connection._execute_clauseelement(\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^\n self, distilled_params, execution_options\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n )\n ^\n File \"/venv/lib/python3.13/site-packages/sqlalchemy/engine/base.py\", line 1640, in _execute_clauseelement\n ret = self._execute_context(\n dialect,\n ...<8 lines>...\n cache_hit=cache_hit,\n )\n File \"/venv/lib/python3.13/site-packages/sqlalchemy/engine/base.py\", line 1846, in _execute_context\n return self._exec_single_context(\n ~~~~~~~~~~~~~~~~~~~~~~~~~^\n dialect, context, statement, parameters\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n )\n ^\n File \"/venv/lib/python3.13/site-packages/sqlalchemy/engine/base.py\", line 1986, in _exec_single_context\n self._handle_dbapi_exception(\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^\n e, str_statement, effective_parameters, cursor, context\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n )\n ^\n File \"/venv/lib/python3.13/site-packages/sqlalchemy/engine/base.py\", line 2355, in _handle_dbapi_exception\n raise sqlalchemy_exception.with_traceback(exc_info[2]) from e\n File \"/venv/lib/python3.13/site-packages/sqlalchemy/engine/base.py\", line 1967, in _exec_single_context\n self.dialect.do_execute(\n ~~~~~~~~~~~~~~~~~~~~~~~^\n cursor, str_statement, effective_parameters, context\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n )\n ^\n File \"/venv/lib/python3.13/site-packages/sqlalchemy/engine/default.py\", line 941, in do_execute\n cursor.execute(statement, parameters)\n ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^\nsqlalchemy.exc.DataError: (psycopg2.errors.InvalidTextRepresentation) invalid input syntax for type uuid: \"73113e984a14fc4d\"\nLINE 6: ...01T00:00:00'::timestamp) AND lastalert.alert_id = '73113e984...\n ^\n\n[SQL: (SELECT %(param_1)s AS facet_id, coalesce((alertenrichment.enrichments) ->> 'severity', (alert.event) ->> 'severity') AS facet_value, count(distinct(lastalert.alert_id)) AS matches_count \nFROM lastalert JOIN alert ON alert.id = lastalert.alert_id AND alert.tenant_id = lastalert.tenant_id LEFT OUTER JOIN alertenrichment ON lastalert.tenant_id = alertenrichment.tenant_id AND lastalert.fingerprint = alertenrichment.alert_fingerprint \nWHERE lastalert.tenant_id = %(tenant_id_1)s AND lastalert.timestamp >= coalesce((SELECT lastalert.timestamp \nFROM lastalert \nWHERE lastalert.tenant_id = %(tenant_id_2)s ORDER BY lastalert.timestamp DESC \n LIMIT %(param_2)s OFFSET %(param_3)s), %(coalesce_1)s) AND lastalert.alert_id = '73113e984a14fc4d' GROUP BY facet_id, facet_value \n LIMIT %(param_4)s) UNION ALL (SELECT %(param_5)s AS facet_id, coalesce((alertenrichment.enrichments) ->> 'status', (alert.event) ->> 'status') AS facet_value, count(distinct(lastalert.alert_id)) AS matches_count \nFROM lastalert JOIN alert ON alert.id = lastalert.alert_id AND alert.tenant_id = lastalert.tenant_id LEFT OUTER JOIN alertenrichment ON lastalert.tenant_id = alertenrichment.tenant_id AND lastalert.fingerprint = alertenrichment.alert_fingerprint \nWHERE lastalert.tenant_id = %(tenant_id_3)s AND lastalert.timestamp >= coalesce((SELECT lastalert.timestamp \nFROM lastalert \nWHERE lastalert.tenant_id = %(tenant_id_4)s ORDER BY lastalert.timestamp DESC \n LIMIT %(param_6)s OFFSET %(param_7)s), %(coalesce_2)s) AND lastalert.alert_id = '73113e984a14fc4d' GROUP BY facet_id, facet_value \n LIMIT %(param_8)s) UNION ALL (SELECT %(param_9)s AS facet_id, CAST(alert.provider_type AS VARCHAR) AS facet_value, count(distinct(lastalert.alert_id)) AS matches_count \nFROM lastalert JOIN alert ON alert.id = lastalert.alert_id AND alert.tenant_id = lastalert.tenant_id LEFT OUTER JOIN alertenrichment ON lastalert.tenant_id = alertenrichment.tenant_id AND lastalert.fingerprint = alertenrichment.alert_fingerprint \nWHERE lastalert.tenant_id = %(tenant_id_5)s AND lastalert.timestamp >= coalesce((SELECT lastalert.timestamp \nFROM lastalert \nWHERE lastalert.tenant_id = %(tenant_id_6)s ORDER BY lastalert.timestamp DESC \n LIMIT %(param_10)s OFFSET %(param_11)s), %(coalesce_3)s) AND lastalert.alert_id = '73113e984a14fc4d' GROUP BY facet_id, facet_value \n LIMIT %(param_12)s) UNION ALL (SELECT %(param_13)s AS facet_id, CAST(coalesce(incident.user_generated_name, incident.ai_generated_name) AS VARCHAR) AS facet_value, count(distinct(lastalert.alert_id)) AS matches_count \nFROM lastalert JOIN alert ON alert.id = lastalert.alert_id AND alert.tenant_id = lastalert.tenant_id LEFT OUTER JOIN alertenrichment ON lastalert.tenant_id = alertenrichment.tenant_id AND lastalert.fingerprint = alertenrichment.alert_fingerprint LEFT OUTER JOIN lastalerttoincident ON lastalert.tenant_id = lastalerttoincident.tenant_id AND lastalert.fingerprint = lastalerttoincident.fingerprint LEFT OUTER JOIN incident ON lastalerttoincident.tenant_id = incident.tenant_id AND lastalerttoincident.incident_id = incident.id AND incident.status = %(status_1)s \nWHERE lastalert.tenant_id = %(tenant_id_7)s AND lastalert.timestamp >= coalesce((SELECT lastalert.timestamp \nFROM lastalert \nWHERE lastalert.tenant_id = %(tenant_id_8)s ORDER BY lastalert.timestamp DESC \n LIMIT %(param_14)s OFFSET %(param_15)s), %(coalesce_4)s) AND lastalert.alert_id = '73113e984a14fc4d' GROUP BY facet_id, facet_value \n LIMIT %(param_16)s) UNION ALL (SELECT %(param_17)s AS facet_id, CASE WHEN (lower((alertenrichment.enrichments) ->> 'dismissed') = %(lower_1)s) THEN %(param_18)s WHEN (lower((alertenrichment.enrichments) ->> 'dismissed') = %(lower_2)s) THEN %(param_19)s WHEN ((alertenrichment.enrichments) ->> 'dismissed' ~ %(alertenrichment_enrichments_->>_'dismissed'_1)s) THEN CASE WHEN (CAST((alertenrichment.enrichments) ->> 'dismissed' AS INTEGER) >= %(param_20)s) THEN %(param_21)s ELSE %(param_22)s END WHEN ((alertenrichment.enrichments) ->> 'dismissed' != %(alertenrichment_enrichments_->>_'dismissed'_2)s) THEN %(param_23)s ELSE %(param_24)s END AS facet_value, count(distinct(lastalert.alert_id)) AS matches_count \nFROM lastalert JOIN alert ON alert.id = lastalert.alert_id AND alert.tenant_id = lastalert.tenant_id LEFT OUTER JOIN alertenrichment ON lastalert.tenant_id = alertenrichment.tenant_id AND lastalert.fingerprint = alertenrichment.alert_fingerprint \nWHERE lastalert.tenant_id = %(tenant_id_9)s AND lastalert.timestamp >= coalesce((SELECT lastalert.timestamp \nFROM lastalert \nWHERE lastalert.tenant_id = %(tenant_id_10)s ORDER BY lastalert.timestamp DESC \n LIMIT %(param_25)s OFFSET %(param_26)s), %(coalesce_5)s) AND lastalert.alert_id = '73113e984a14fc4d' GROUP BY facet_id, facet_value \n LIMIT %(param_27)s) /*db_driver='psycopg2',db_framework='sqlalchemy%%3A2.0.36',traceparent='00-ac060a29daa99594159b42db980caa97-4e1455ce4385de19-01'*/]\n[parameters: {'param_1': 'severity5eaf5f8bd091a5201757b40ff3fd07e02d7bd509', 'tenant_id_1': 'keep', 'tenant_id_2': 'keep', 'param_2': 1, 'param_3': 49999, 'coalesce_1': datetime.datetime(1, 1, 1, 0, 0), 'param_4': 50, 'param_5': 'status5eaf5f8bd091a5201757b40ff3fd07e02d7bd509', 'tenant_id_3': 'keep', 'tenant_id_4': 'keep', 'param_6': 1, 'param_7': 49999, 'coalesce_2': datetime.datetime(1, 1, 1, 0, 0), 'param_8': 50, 'param_9': 'source5eaf5f8bd091a5201757b40ff3fd07e02d7bd509', 'tenant_id_5': 'keep', 'tenant_id_6': 'keep', 'param_10': 1, 'param_11': 49999, 'coalesce_3': datetime.datetime(1, 1, 1, 0, 0), 'param_12': 50, 'param_13': 'incident.name5eaf5f8bd091a5201757b40ff3fd07e02d7bd509', 'status_1': 'firing', 'tenant_id_7': 'keep', 'tenant_id_8': 'keep', 'param_14': 1, 'param_15': 49999, 'coalesce_4': datetime.datetime(1, 1, 1, 0, 0), 'param_16': 50, 'param_17': 'dismissed5eaf5f8bd091a5201757b40ff3fd07e02d7bd509', 'lower_1': 'true', 'param_18': 'true', 'lower_2': 'false', 'param_19': 'false', \"alertenrichment_enrichments_->>_'dismissed'_1\": '^[0-9]+$', 'param_20': 1, 'param_21': 'true', 'param_22': 'false', \"alertenrichment_enrichments_->>_'dismissed'_2\": '', 'param_23': 'true', 'param_24': 'false', 'tenant_id_9': 'keep', 'tenant_id_10': 'keep', 'param_25': 1, 'param_26': 49999, 'coalesce_5': datetime.datetime(1, 1, 1, 0, 0), 'param_27': 50}]\n(Background on this error at: https://sqlalche.me/e/20/9h9h)", "taskName": "Task-13269"}
The 500 Internal Server Error is caused by the backend accepting an invalid alert_id (like "73113e984a14fc4d") and using it directly in SQL queries, where Postgres expects a valid UUID. This triggers a type error and crashes the backend because thereās no input validation for alert_id before itās used in queries. This affects both the /alerts/query and /alerts/facets/options endpoints and is a systemic issue in the current implementationāthereās no global mechanism to ensure alert_id is a valid UUID before database operations. Defensive input validation should be added to prevent this class of errors and avoid backend crashes when invalid IDs are passedĀ citation. Recent PRs show ongoing work to improve UUID handling, but this validation gap remainsĀ citation.
To reply, just mention @dosu.
How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report š | OtherĀ Ā Ā
This is still a problem with Version: 0.47.9 | Build: a19ad7