Skip to content

fix: classify_error falls back to exception type name when message is blank - #5

Merged
kratsg merged 1 commit into
mainfrom
fix/blank-timeout-error-message
Sep 10, 2026
Merged

kratsg merged 1 commit into
mainfrom
fix/blank-timeout-error-message

Conversation

@kratsg

@kratsg kratsg commented Sep 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Every read-only ServiceX tool call was returning a blank Error: \n\n**Recovery:** ... message with no indication of what actually failed.
  • Root cause of the blank message: classify_error() builds f"Error: {exc_msg}\n\n**Recovery:** {guidance}" from exc_msg = str(exc). Some exceptions we hit in practice — notably a bare timeout from ProxyClient.access_token() (10s hardcoded timeout in af_credentials/proxy.py calling the broker's POST /v1/credentials/servicex/redeem) — have an empty str(exc), so the message collapsed to nothing.
  • Fix: fall back to the exception type name when str(exc) is empty, so the caller always sees something (Error: TimeoutError instead of Error: ).
  • This does not fix the underlying ~10s timeout itself (that's on the broker/servicex-token-service side, traced separately) — it makes the failure diagnosable instead of silent.

Test plan

  • Added TestClassifyError::test_blank_message_falls_back_to_exception_type_name and test_other_category_blank_message_falls_back_to_exception_type_name, confirmed both fail against the old code and pass against the fix (TDD).
  • pixi run -e py312 pytest -m "not slow" — 299 passed.
  • prek run --files src/servicex_mcp/tools/_helpers.py tests/test_helpers.py — all hooks (ruff, mypy, codespell, etc.) passed.

🤖 Generated with Claude Code

… blank

A bare exception (e.g. a ProxyClient redeem call to the broker's
/v1/credentials/servicex/redeem exceeding its 10s timeout) has an empty
str(exc), which classify_error() propagated verbatim into
"Error: \n\n**Recovery:** ...", giving operators no clue what actually
failed. Fall back to the exception type name so every read-only tool
error at least names the failure class.

Assisted-by: Claude Sonnet 5 <noreply@anthropic.com>
@kratsg
kratsg merged commit 75f8250 into main Sep 10, 2026
11 checks passed
@kratsg
kratsg deleted the fix/blank-timeout-error-message branch September 10, 2026 20:54
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