Skip to content

fix: surface actionable error messages for billing and auth failures#1249

Open
anishesg wants to merge 1 commit intoanthropics:mainfrom
anishesg:fix/ph-issue-874
Open

fix: surface actionable error messages for billing and auth failures#1249
anishesg wants to merge 1 commit intoanthropics:mainfrom
anishesg:fix/ph-issue-874

Conversation

@anishesg
Copy link
Copy Markdown

Summary

When an API key has no credits (or has an auth failure), the action exited with code 1 and printed only a minified JavaScript stack trace with no useful diagnostic information. Users had no way to know from the logs that the problem was billing-related.

There were two root causes in base-action/src/run-sdk.ts:

  1. isSuccess on line 205 only checked resultMessage.subtype === "success" and ignored the is_error flag entirely, so a result with subtype: "success", is_error: true (the billing failure case) was treated as successful by the conclusion logic but then fell through to the error path with no useful message.
  2. sanitizeSdkOutput stripped the errors array and result string fields from the logged result summary, so the actual error text from the SDK was never visible in action logs.

Changes

  • Add getResultErrorText() to extract error details from both the errors array and the result string field of an SDKResultMessage.
  • Add formatErrorMessage() to map known error patterns (insufficient credits, invalid API key) to clear, actionable messages with links to the console.
  • Fix isSuccess to require both subtype === "success" AND !is_error.
  • Update sanitizeSdkOutput to include the error text in the logged summary when is_error is true, ensuring failures are always visible even when show_full_output is disabled.
  • Replace the existing failure throw with getResultErrorText + formatErrorMessage so the GitHub Actions step error annotation shows a human-readable message.

Fixes #874

## Summary

Signed-off-by: anish k <ak8686@princeton.edu>
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.

Unhelpful error message when API key has no credits

1 participant