Skip to content

fix: handle missing/invalid slug with user-friendly error - #764

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

fix: handle missing/invalid slug with user-friendly error#764
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/cli-33-invalid-slug-error

Conversation

@sentry

@sentry sentry Bot commented Aug 19, 2026

Copy link
Copy Markdown

This PR addresses CLI-33, where users encountered an unhandled ValueError when the --slug parameter was missing or invalid, particularly in CI environments where auto-detection might fail (e.g., Bitbucket).

Problem:

  • The encode_slug function in codecov_cli/helpers/encoder.py would raise a ValueError if the provided slug was None or malformed.
  • This ValueError was not caught by upstream callers like create_commit_logic, leading to an unhandled exception and a crash of the CLI process.
  • Users received a generic Python traceback instead of actionable feedback.

Solution:

  • Replaced the ValueError in encode_slug with click.UsageError. This ensures that invalid slug formats result in a user-friendly error message and a clean exit from the CLI.
  • Added an explicit check for a None or empty slug in create_commit_logic within codecov_cli/services/commit/__init__.py. If the slug is missing, a click.UsageError is raised, guiding the user to provide the --slug owner/repo option when auto-detection is not possible.

Impact:

  • Prevents CLI crashes due to missing or invalid slugs.
  • Provides clear, actionable error messages to users, improving the overall user experience and reducing support inquiries.

Fixes CLI-33

This PR was automatically generated by Sentry. You can adjust this setting at any time.

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