[GH-ISSUE #2135] [Bug] An invalid REA_LOG_LEVEL crashes every CLI command with a ZodError stack trace #697

Closed
opened 2026-10-15 18:27:29 +00:00 by bsakaguchi · 0 comments
Owner

Originally created by @kaoru0822-kitauji on GitHub (Oct 12, 2026).
Original GitHub issue: https://github.com/morluto/rea/issues/2135

Observed behavior

Any CLI invocation with an invalid REA_LOG_LEVEL crashes with an uncaught ZodError stack trace before the command runs. This includes rea doctor and rea --help:

$ REA_LOG_LEVEL=loud rea doctor --json
file:///…/dist/cli-runtime/logger-….js:18
		parseLogLevel = (value) => logLevelSchema.parse(value);
		                                          ^
ZodError: [ { "code": "invalid_value", "values": ["trace","debug","info","warn","error","fatal","silent"], … } ]
    at parseLogLevel (…)
    at createCli (…)
    at …/scripts/rea.mjs:76:11

REA_LOG_LEVEL=INFO (uppercase) crashes the same way. The MCP server reports the same setting cleanly and exits 1:

$ REA_LOG_LEVEL=loud rea mcp
REA configuration is invalid: REA_LOG_LEVEL: Invalid option: expected one of "trace"|"debug"|"info"|"warn"|"error"|"fatal"|"silent".

Expected behavior

The CLI reports the invalid setting with the same configuration message and a non-zero exit, without a stack trace.

Cause

createCli in src/cli.ts calls parseLogLevel from src/logger.ts, which uses a throwing logLevelSchema.parse. The MCP entry point instead goes through parseConfig → parseEnvironment, which returns a ConfigurationError result.

Current main c22111eca, macOS, Node 26.

Originally created by @kaoru0822-kitauji on GitHub (Oct 12, 2026). Original GitHub issue: https://github.com/morluto/rea/issues/2135 ### Observed behavior Any CLI invocation with an invalid `REA_LOG_LEVEL` crashes with an uncaught `ZodError` stack trace before the command runs. This includes `rea doctor` and `rea --help`: ```text $ REA_LOG_LEVEL=loud rea doctor --json file:///…/dist/cli-runtime/logger-….js:18 parseLogLevel = (value) => logLevelSchema.parse(value); ^ ZodError: [ { "code": "invalid_value", "values": ["trace","debug","info","warn","error","fatal","silent"], … } ] at parseLogLevel (…) at createCli (…) at …/scripts/rea.mjs:76:11 ``` `REA_LOG_LEVEL=INFO` (uppercase) crashes the same way. The MCP server reports the same setting cleanly and exits 1: ```text $ REA_LOG_LEVEL=loud rea mcp REA configuration is invalid: REA_LOG_LEVEL: Invalid option: expected one of "trace"|"debug"|"info"|"warn"|"error"|"fatal"|"silent". ``` ### Expected behavior The CLI reports the invalid setting with the same configuration message and a non-zero exit, without a stack trace. ### Cause `createCli` in `src/cli.ts` calls `parseLogLevel` from `src/logger.ts`, which uses a throwing `logLevelSchema.parse`. The MCP entry point instead goes through `parseConfig` → `parseEnvironment`, which returns a `ConfigurationError` result. Current main c22111eca, macOS, Node 26.
bsakaguchi 2026-10-15 18:27:29 +00:00
  • closed this issue
  • added the
    bug
    label
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#697
No description provided.