Skip to content

fix(api): don't warn with a traceback when alias resolution hits a missing API key - #5409

Merged
nicoloboschi merged 2 commits into
mainfrom
fix/quiet-unauthenticated-alias-resolution
Oct 7, 2026
Merged

nicoloboschi merged 2 commits into
mainfrom
fix/quiet-unauthenticated-alias-resolution

Conversation

@nicoloboschi

Copy link
Copy Markdown
Collaborator

Problem

Bank alias resolution runs before the request is authenticated. With a tenant extension that requires an API key, every request that arrives without one makes the resolver raise AuthenticationError. That case was caught by the generic handler and logged as a WARNING with a full traceback.

It is harmless — the id is used as-is and auth rejects the request a moment later — but under steady unauthenticated traffic it logs one traceback per request, which buries the logs you actually need.

Fix

In both places that resolve aliases (UnknownParamsRoute and MCPMiddleware), catch AuthenticationError on its own and log it at DEBUG with no traceback. Any other failure still logs the WARNING with traceback, as before.

Test plan

  • New test in tests/test_unknown_params.py: a resolver that raises AuthenticationError logs one DEBUG line with no traceback, and a resolver that raises some other error still logs the WARNING. The test fails without the fix.
  • tests/test_unknown_params.py and tests/test_mcp_routing.py pass (35 tests). ruff check / ruff format --check are clean.

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 this pull request may close these issues.

1 participant