Skip to content

fix: guard empty aliases list in 'llm aliases list' - #1604

Open
abhi-0203 wants to merge 1 commit into
simonw:mainfrom
abhi-0203:fix/aliases-list-empty
Open

fix: guard empty aliases list in 'llm aliases list'#1604
abhi-0203 wants to merge 1 commit into
simonw:mainfrom
abhi-0203:fix/aliases-list-empty

Conversation

@abhi-0203

Copy link
Copy Markdown

Summary

Fixes a ValueError: max() arg is an empty sequence when running llm aliases list on a fresh install or after removing all aliases.

The --json variant already handles the empty case correctly (returns {}), but the plain text path calls max() on an empty sequence before checking whether there is anything to display.

Fix

Add an early return when no aliases exist, before the max() call. This matches the --json path's behavior.

Reproduction

llm aliases list  # on fresh install with no aliases defined
# ValueError: max() arg is an empty sequence

Closes #1602

The plain text path of 'llm aliases list' called max() on an empty
sequence when no aliases were defined, raising ValueError. The --json
variant already handled this correctly.

Add an early return when no aliases exist, matching the --json path's
behavior.

Closes simonw#1602
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.

llm aliases list crashes with ValueError when no aliases are defined

1 participant