Skip to content

Reject an envvar that is not a string or a list of strings - #2001

Open
herniqeu wants to merge 2 commits into
fastapi:masterfrom
herniqeu:fix/envvar-type
Open

herniqeu wants to merge 2 commits into
fastapi:masterfrom
herniqeu:fix/envvar-type

Conversation

@herniqeu

@herniqeu herniqeu commented Nov 3, 2026

Copy link
Copy Markdown

envvar names an environment variable (or a list of them), but the value was never checked: typer.Option(envvar=123) was accepted when the parameter was declared and only failed when the command ran, with TypeError: 'int' object is not iterable raised inside click's envvar resolution - and under CliRunner the traceback is swallowed, leaving exit code 1 with no output at all. The value is now validated where the parameter is built, with a TypeError naming it and showing the expected shape; a string and a list of strings behave as before. Tests added.

This branch has not been deployed

No deployments
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.

1 participant