Skip to content

catch_exception crashes when request.state.tenant_id is unset #6855

Description

@juangalt

keep/api/api.py catch_exception formats request.state.trace_id and request.state.tenant_id while handling an exception. Starlette State.__getattr__ raises AttributeError when either attribute is absent, so the handler fails and the original exception is discarded.

The same body is on v0.53.0 and current main. Fix: getattr for both attributes and logger.exception, keeping the JSON 500 shape {message, trace_id, error_msg}.

PR: #6854

This is not #6089 or #6100; those are different tenantId surfaces.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions