Skip to content

AI junk - #3785

Closed
eknathdj wants to merge 1 commit into
pallets:mainfrom
eknathdj:fix-aliasedgroup-resolve-command-none
Closed

AI junk#3785
eknathdj wants to merge 1 commit into
pallets:mainfrom
eknathdj:fix-aliasedgroup-resolve-command-none

Conversation

@eknathdj

Copy link
Copy Markdown

The AliasedGroup example overrides resolve_command and does return cmd.name, cmd, args. During shell completion (resilient parsing) of an unknown or mistyped command, the base Group.resolve_command returns cmd = None, so cmd.name raises AttributeError: 'NoneType' object has no attribute 'name'.

Click's base Group.resolve_command already guards this with cmd_name if cmd else None; this change makes the example do the same (return cmd.name if cmd else None, cmd, args). The identical bug is in the runnable examples/aliases/aliases.py, fixed here too.

Verified on click 8.4.2 (Python 3.14): the current example raises the AttributeError during completion of an unknown command; with the fix, completion returns the expected results.

Closes #2402.

@davidism davidism closed this Aug 21, 2026
@davidism

Copy link
Copy Markdown
Member

@davidism davidism added the rejected AI Contribution rejected because of its untrustworthy AI origin label Aug 21, 2026
@davidism davidism changed the title Fix AliasedGroup example crashing on unknown command during completion AI junk Aug 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rejected AI Contribution rejected because of its untrustworthy AI origin

Projects

None yet

Development

Successfully merging this pull request may close these issues.

resolve_command fails if cmd is None

2 participants