[BUG] edit-issue-labels.sh silently exits with code 1 when called with no label arguments
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
scripts/edit-issue-labels.sh exits with code 1 but prints no message to stdout or stderr when invoked with no --add-label or --remove-label arguments (lines 40-42):
if [[ ${#ADD_LABELS[@]} -eq 0 && ${#REMOVE_LABELS[@]} -eq 0 ]]; then
exit 1
fi
Every other error path in the same script prints a descriptive message to stderr before exiting:
Line 15: echo "Error: no issue number in event payload" >&2
Line 34: echo "Error: unknown argument (only --add-label and --remove-label are accepted)" >&2
This is the only error path that is silent. Since the script runs in CI with set -euo pipefail, a silent exit 1 causes the workflow step to fail with zero diagnostic output, making it impossible to determine the cause of failure from the logs.
What Should Happen?
The script should print a descriptive error message to stderr before exiting, consistent with all other error paths in the same file. For example:
echo "Error: at least one --add-label or --remove-label argument is required" >&2
exit 1
Error Messages/Logs
Steps to Reproduce
1) Clone the repository
2) Set the required env var: export GITHUB_EVENT_PATH=$(mktemp); echo '{"issue":{"number":1}}' > $GITHUB_EVENT_PATH
3) Run the script with no label arguments: bash scripts/edit-issue-labels.sh
4) Observe: the script exits with code 1 and prints nothing to stdout or stderr
5) Compare to running with an unknown argument: bash scripts/edit-issue-labels.sh --foo bar
— that path correctly prints "Error: unknown argument..." to stderr before exiting
Claude Model
Not sure / Multiple models
Is this a regression?
No, this never worked
Last Working Version
_No response_
Claude Code Version
2.1.185
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
Affected file: scripts/edit-issue-labels.sh, lines 40-42
https://github.com/anthropics/claude-code/blob/main/scripts/edit-issue-labels.sh#L40-L42
There is a second silent exit at lines 62-64 (exit 0 when all provided labels don't exist in the repo). That one is arguably intentional as a graceful no-op, but it is also undocumented and could be confusing to callers.