Skip to content

馃悰 Fix formatting in NoSuchOption.format_message() - #1843

Merged
svlandeg merged 1 commit into
fastapi:masterfrom
foomunleong:patch-1
Jun 17, 2026
Merged

馃悰 Fix formatting in NoSuchOption.format_message()#1843
svlandeg merged 1 commit into
fastapi:masterfrom
foomunleong:patch-1

Conversation

@foomunleong

Copy link
Copy Markdown
Contributor

Pull Request

Discussion: #1840

Description

NoSuchOption.format_message() in typer/_click/exceptions.py produces a tuple
repr in its output instead of a plain string when possibilities is non-empty.

Current output:
Error: No such option: --fooo ('(Possible options: --foo)',)

Expected output:
Error: No such option: --fooo (Possible options: --foo)

Checklist

  • This PR is an obvious typo fix, or it links to a GitHub Discussion for the proposed code change.
  • I added tests for the change.
  • The new or updated tests fail on the main branch and pass on this PR.
  • Coverage stays at 100%.
  • The documentation explains the change if needed.

It used to be:
No such option: --param-a (Possible options: --param-b, --param-c)

And now it becomes:
No such option: --param-a ('(Possible options: --param-b, --param-c)',)
@svlandeg svlandeg added the bug Something isn't working label Jun 17, 2026
@svlandeg svlandeg changed the title Fix formatting in NoSuchOption.format_message() 馃悰 Fix formatting in NoSuchOption.format_message() Jun 17, 2026

@svlandeg svlandeg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR and for going through the standard flow of opening a discussion first! 馃檹

This is indeed a typo from the vendoring (in which we removed ngettext from the original code here).

While this is considered internals and some of these error messages may still change in the future, for now it's an obvious little bug/typo that we should fix. I don't feel like a regression test is necessary at this point.

Merging 馃帀

@svlandeg
svlandeg merged commit f0bc3a3 into fastapi:master Jun 17, 2026
23 of 24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants