googleapis/mcp-toolbox · error
embedding model does not exist: %s
Error message
embedding model does not exist: %s
What it means
EmbedParams fails fast when a parameter's configured embedding model name cannot be found in the model manager (pMgr.GetEmbeddingModel returned !ok). It means the tool config references an embedding model that was never registered under that exact name. This is a configuration/name resolution problem, not a runtime API failure.
Source
Thrown at internal/util/parameters/parameters.go:209
}
// Get parameter's value to be embedded
valueStr, ok := paramValues[i].Value.(string)
if !ok {
return nil, fmt.Errorf("parameter '%s' is marked for embedding but has a non-string value (type: %T)", p.GetName(), paramValues[i].Value)
}
parametersToEmbed[modelName] = append(parametersToEmbed[modelName], ParamToEmbed{
OriginalValue: valueStr,
Index: i,
})
}
// Batch embedding request sent to each model
for modelName, params := range parametersToEmbed {
model, ok := pMgr.GetEmbeddingModel(modelName)
if !ok {
return nil, fmt.Errorf("embedding model does not exist: %s", modelName)
}
// Extract only the string values for the API call
stringBatch := make([]string, len(params))
for i, paramStr := range params {
stringBatch[i] = paramStr.OriginalValue
}
embeddings, err := model.EmbedParameters(ctx, stringBatch)
if err != nil {
return nil, fmt.Errorf("error embedding parameters with model %s: %w", modelName, err)
}
if len(embeddings) != len(stringBatch) {
return nil, fmt.Errorf("model %s returned %d embeddings for %d inputs", modelName, len(embeddings), len(stringBatch))
}
for i, rawVector := range embeddings {View on GitHub (pinned to 8cc6e09de2)
Solutions
- Compare the model name in the error with the keys of your embeddingModels config section; fix the name so they match exactly (case-sensitive).
- Add the missing embedding model definition so it is registered with the model manager before EmbedParams is called.
- Diff your customized tools config against the upstream/prebuilt version to find the renamed or removed model entry.
- Dump the registered embedding model keys at startup and validate all references in a unit test.
Example fix
# before (name mismatch)
embeddingModels:
myEmbedModel:
kind: gemini
tools:
search:
kind: mysqldata-sql
embeddingModel: my-embed-model
# after (exact match)
embeddingModels:
myEmbedModel:
kind: gemini
tools:
search:
kind: mysqldata-sql
embeddingModel: myEmbedModel Defensive patterns
Strategy: validation
Validate before calling
for _, name := range referencedEmbeddingModels {
if _, ok := mgr.GetEmbeddingModel(name); !ok {
return fmt.Errorf("unknown embedding model %q", name)
}
} Type guard
func embeddingModelExists(mgr *models.Manager, name string) bool {
_, ok := mgr.GetEmbeddingModel(name)
return ok
} Try / catch
res, err := params.EmbedParams(ctx, pMgr, p)
if err != nil {
if strings.Contains(err.Error(), "embedding model does not exist") {
// fix config / register model, then retry once
}
return err
} Prevention
- Define embedding model names once (YAML anchor or constant) and reference them everywhere.
- At startup, validate every referenced embedding model resolves before serving traffic.
- Add a unit test that parses your tools file and calls GetEmbeddingModel for each reference.
When it happens
Trigger: Calling EmbedParams (directly or via a tool invocation with parameter embeddings enabled) where the embedding model name grouped under parametersToEmbed does not match any key registered in the model manager — e.g. a typo in the model name in the tools YAML, or the embedding model definition was omitted/renamed.
Common situations: Renaming a model in the embeddingModels section without updating parameter references; typos or case mismatches in the model name; users overriding prebuilt configs and dropping the embedding model definition; loading a partial tools file that lacks the model block.
Related errors
- unable to initialize logger: %w
- invalid log level
- unable to initialize tool %q: %w
- unable to retrieve source %q for tool %q
- unable to initialize group %q: %w
AI-assisted analysis of googleapis/mcp-toolbox@8cc6e09de2 (2026-09-05).
Data as JSON: /api/errors/5bd110ce86d93bc0.
Report an issue: GitHub.