Skip to content

Narrow except ValueError in embed-multi to only handle missing-model case - #1578

Open
ikatyal2110 wants to merge 2 commits into
simonw:mainfrom
ikatyal2110:fix-embed-multi-valueerror
Open

Narrow except ValueError in embed-multi to only handle missing-model case#1578
ikatyal2110 wants to merge 2 commits into
simonw:mainfrom
ikatyal2110:fix-embed-multi-valueerror

Conversation

@ikatyal2110

Copy link
Copy Markdown
Contributor

The broad except ValueError around Collection() in the embed-multi command would silently convert any ValueError (e.g. from a database migration failure) into the misleading "You need to specify an embedding model" message. The fix extracts the model ID first, then only shows the user-friendly message when no model was provided; all other ValueErrors are re-raised. A regression test verifies that a non-model ValueError propagates instead of being masked. Fixes #1523


Generated by Claude Code

…rrors

A broad `except ValueError` around `Collection()` would mask any ValueError
from database migrations or other internal operations with the misleading
"no embedding model" message. Only catch ValueError when no model was
specified.
Comment thread llm/cli.py Outdated
"You need to specify an embedding model (no default model is set)"
)
collection_obj = Collection(collection, db=db, model_id=effective_model_id)
except ValueError as e:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

the same masking exists in embed a couple hundred lines up: if -m names a model that isn't installed, get_embedding_model raises UnknownModelError and the handler turns it into "You need to specify an embedding model (no default model is set)", which is confusing when you did specify one. worth the same if model is None guard there so an unknown-model error surfaces as itself.

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.

Embeddings migrations fail with sqlite-utils 4.0; embed-multi masks it as "You need to specify an embedding model"

2 participants