Skip to content

fix: handle invalid slug ValueError gracefully in CLI - #743

Open
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/cli-invalid-slug-error
Open

fix: handle invalid slug ValueError gracefully in CLI#743
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/cli-invalid-slug-error

Conversation

@sentry

@sentry sentry Bot commented Jul 27, 2026

Copy link
Copy Markdown

This PR addresses an issue where providing an invalid slug (not in <owner>/<repo> format) to the CLI upload command would cause encode_slug() to raise an unhandled ValueError.

Previously, this ValueError would bypass Click's error handling, leading to the error being caught by the global excepthook and reported to Sentry as an unexpected error, causing unnecessary noise.

The fix involves:

  • Replacing the ValueError with a click.ClickException in codecov_cli/helpers/encoder.py. This ensures that Click handles the error gracefully, providing a user-friendly message directly in the CLI.
  • Adding import click to codecov_cli/helpers/encoder.py.
  • Adding the specific error message "The provided slug is invalid" to the _SAMPLED_MESSAGES list in codecov_cli/opentelemetry.py. This acts as a safeguard to filter out any potential residual Sentry reports for this known user input error.

Fixes CLI-6M

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.

0 participants