Skip to content

[eas-cli] Add error codes to the --json error output - #4594

Draft
vonovak wants to merge 1 commit into
vonovak/json-error-outputfrom
vonovak/json-error-codes
Draft

vonovak wants to merge 1 commit into
vonovak/json-error-outputfrom
vonovak/json-error-codes

Conversation

@vonovak

@vonovak vonovak commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Why

#4593 prints {"error": {"message", "requestId"?}} when a --json command fails. A program must still match the message text to tell a project that is not linked from a run that is not logged in. In expo/expo-agent-cli, those two failures each get their own fix, and today it matches EAS project not configured and the login sentence.

Stacked on #4593. This is the fourth PR in the stack: #4591 ← #4592 ← #4593 ← #4594 (this PR). It is separate because codes become a public contract. The eas-cli team decides whether eas-cli wants to keep these codes stable. #4591–#4593 do not depend on this PR.

How

  • EasCommandError takes an optional code.
  • Two codes, both set by eas-cli:
    • EAS_PROJECT_NOT_CONFIGURED: getUnconfiguredProjectError returns an EasCommandError with this code. It covers its three callers.
    • EAS_LOGIN_REQUIRED: the non-interactive login prompt in SessionManager passes oclif's own code option to Errors.error.
  • EasCommand.catch adds code to the JSON error for an EasCommandError or an oclif CLIError. Errors.exit (EEXIT) is handled before that and has no code.
  • GraphQL errorCode values are not printed. They belong to the server, and a server rename would break programs that read --json.

Open questions for the eas-cli team:

  • Should eas-cli define codes at all, and which naming scheme should they use?
  • Should more failures get codes?

LLM Authorship

Test Plan

  • EasCommand tests: the code of an EasCommandError and of an oclif CLIError is printed. A GraphQL error prints its request ID and no code. Errors.exit has no code.
  • getProjectIdAsync test: the non-interactive error has code: 'EAS_PROJECT_NOT_CONFIGURED'.
  • SessionManager test: showLoginPromptAsync({ nonInteractive: true }) rejects with code: 'EAS_LOGIN_REQUIRED' and does not prompt.
  • Real run, not logged in, build:list --json --non-interactive: stdout is {"error": {"message": "Either log in with eas login or set the EXPO_TOKEN ...", "code": "EAS_LOGIN_REQUIRED"}}.
  • tsc, oxlint and oxfmt are clean.

🤖 Generated with Claude Code

@codecov

codecov Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (vonovak/json-error-output@1dcfc9a). Learn more about missing BASE report.

Additional details and impacted files
@@                     Coverage Diff                      @@
##             vonovak/json-error-output    #4594   +/-   ##
============================================================
  Coverage                             ?   74.06%           
============================================================
  Files                                ?     1018           
  Lines                                ?    49572           
  Branches                             ?    10691           
============================================================
  Hits                                 ?    36711           
  Misses                               ?    11868           
  Partials                             ?      993           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@vonovak
vonovak added this pull request to stack #4595 October 9, 2026 19:52
A program that reads the --json error must still match the message
to tell a project that is not linked from a run that is not logged in.

- EasCommandError takes an optional code.
- getUnconfiguredProjectError: EAS_PROJECT_NOT_CONFIGURED.
- Non-interactive login prompt: EAS_LOGIN_REQUIRED (oclif's own code
  option on Errors.error).
- EasCommand.catch prints the code of an EasCommandError or CLIError.
  GraphQL error codes stay out: they belong to the server.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vonovak
vonovak force-pushed the vonovak/json-error-codes branch from 5232cfb to a27a7f5 Compare October 12, 2026 08:04
@github-actions

Copy link
Copy Markdown

✅ Thank you for adding the changelog entry!

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