Uh oh!
There was an error while loading. Please reload this page.
fix(cli): write error message to stderr before showing help - #34604
fix(cli): write error message to stderr before showing help#34604Robin1987China wants to merge 1 commit into
Conversation
The following comment was made by an LLM, it may be inaccurate: I found several related PRs that address similar CLI error handling issues:
These PRs (especially #31228 and #31488) appear to be addressing the exact same problem as PR #34604 - ensuring error messages are displayed before help output when the user provides invalid arguments. You may want to verify whether these earlier PRs were closed without merging or if there's a reason they need to be revisited with this new approach. |
When the user passes an unknown argument or invalid value, the .fail() handler calls cli.showHelp() but never writes the error message to stderr. This makes opencode --unkown-flag silently show help output identical to opencode --help, leaving the user unaware of the error. Closesanomalyco#29390
ecaafb4 to
82bea58CompareAutomated PR Cleanup Thank you for contributing to opencode. Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions. This PR was closed because it matched the following cleanup criteria:
PRs created within the last month are not affected by this cleanup. If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate. Thanks again for taking the time to contribute. |
Issue for this PR
Closes#29390
Type of change
What does this PR do?
When the user passes an unknown argument or invalid value, the .fail() handler calls cli.showHelp() but never writes the error message to stderr. This makes
opencode --unknown-flagsilently show help output identical toopencode --help, leaving the user unaware of the error.This adds
process.stderr.write(msg + "\n")before showing help so the user sees what went wrong.How did you verify your code works?
Checklist