Truncate Metabase API errors; add --verbose for full bodies#18
Merged
Conversation
Metabase returns 5-20 KB Clojure stacktraces for most 500s. Printing the full body on every failure blew the LLM context window when driving the CLI from Claude. Errors now extract the top-level message/error/cause (or compact validation errors) into a one-line summary. The raw body is still available via --verbose or METABASE_CLI_VERBOSE=1. Applies to both HTTP errors (via new ApiError class) and in-band query execution failures. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
e3bf3c5 to
7284358
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
via,trace,data,stacktrace). Printing those verbatim blew the LLM context window when driving the CLI from Claude.message/error/cause(or a flattenederrorsfield-map for validation errors) into a one-line summary. Raw body still available via--verboseorMETABASE_CLI_VERBOSE=1.ApiErrorclass replaces barethrow new Error) and in-band query-execution failures (result.status === "failed").Measured impact (live on v0.59.4)
--verboseTest plan
npm run typechecknpm run lint(no new warnings)npm run format:checknpm test— 145/145 passing (14 new intest/errors.test.ts)metabase.codingninjas.comv0.59.4: verified short-form output for 404, 400 validation, 500 QP failures, 500 template-tag corruption; verified--verboseandMETABASE_CLI_VERBOSE=1both print full bodies🤖 Generated with Claude Code