Conversation
With `CLOUDINARY_URL=garbage`, every command printed a Python traceback. The SDK reads the variable when it is imported, before `main()` can handle errors. Catch the `ValueError` from `import cloudinary` and exit with one line that tells the user to fix or unset the variable. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
TalLevAmi
marked this pull request as ready for review
September 26, 2026 16:15
const-cloudinary
requested changes
Sep 27, 2026
const-cloudinary
left a comment
Member
There was a problem hiding this comment.
@TalLevAmi , this is a nice bug.
Unfortunately, the fix is not quite complete.
We have a few ways to configure CLI, using cld -C or cld -c. They take precedence over ENV variable, so we should not crash in this case, even if ENV variable is broken.
And this PR does not address CLOUDINARY_ACCOUNT_URL, which produces similar error.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
With an invalid
CLOUDINARY_URL(for exampleCLOUDINARY_URL=garbage), everycldcommand printed a full Python traceback that ended inValueError: Invalid CLOUDINARY_URL scheme. The SDK reads the variable when it is imported, so the error occurs before the error handling inmain().Now the output is:
Brief Summary of Changes
cloudinary_cli/__init__.pycatchesValueErrorfromimport cloudinaryand callssys.exitwith the message. The exit code is 1.What does this PR address?
Are tests included?
Reviewer, please note:
CLOUDINARY_URLis invalid and you select a saved config with-C. This is the same as before, because the SDK cannot be imported with that value.Checklist:
Local test run: I ran the full suite on Python 3.8 with Click 8.1.8. The new tests pass, and they fail without the fix. 8 tests in
test_cli_agent.pyandtest_cli_config_oauth.pyfail withstderr not separately capturedon this branch and onmastertoo. These tests need Click 8.2, which needs Python 3.10 or later. CI must confirm the full result.🤖 Generated with Claude Code