Skip to content

cli: invalid catalog --type exits 1 with runtime_error instead of a usage error (exit 2) #7669

Closed

Description

@jrusso1020

hyperframes catalog --type <value> only accepts block or component. Any other value is a usage mistake, and the CLI's contract for usage mistakes is exit code 2, with a usage_error envelope under --json (see packages/cli/src/cli.agentMode.test.ts).

catalog doesn't follow that contract today:

$ hyperframes catalog --type widget --json
Invalid --type: "widget". Use "block" or "component".
# exit code 1, error kind runtime_error

The cause is in packages/cli/src/commands/catalog.ts (around line 228). The invalid-value branch prints the message and calls finishCommand(1).

What to do

  1. Report the bad value as a usage error, the way other commands do. check.ts throws CliUsageError, and failUsage in packages/cli/src/utils/commandResult.ts is a helper for the same job.
  2. Add a test showing that catalog --type widget exits 2 and, with --json, returns usage_error with the message. cli.agentMode.test.ts has a table of similar cases you can extend.

— Rames Jusso

Activity

  1. added
    bug
    difficulty/easy
    good first issue
    help wanted
    on Nov 13, 2026
  2. jvarah commented on Nov 13, 2026

    @jvarah
    Contributor

    I'll take this issue!

  3. added a commit that references this issue on Nov 14, 2026
    affa03b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugdifficulty/easygood first issuehelp wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions