{"record":{"id":"5bd110ce86d93bc0","repo":"googleapis/mcp-toolbox","slug":"embedding-model-does-not-exist-s","errorCode":null,"errorMessage":"embedding model does not exist: %s","messagePattern":"embedding model does not exist: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/util/parameters/parameters.go","lineNumber":209,"sourceCode":"\t\t}\n\n\t\t// Get parameter's value to be embedded\n\t\tvalueStr, ok := paramValues[i].Value.(string)\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"parameter '%s' is marked for embedding but has a non-string value (type: %T)\", p.GetName(), paramValues[i].Value)\n\t\t}\n\n\t\tparametersToEmbed[modelName] = append(parametersToEmbed[modelName], ParamToEmbed{\n\t\t\tOriginalValue: valueStr,\n\t\t\tIndex:         i,\n\t\t})\n\t}\n\n\t// Batch embedding request sent to each model\n\tfor modelName, params := range parametersToEmbed {\n\t\tmodel, ok := pMgr.GetEmbeddingModel(modelName)\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"embedding model does not exist: %s\", modelName)\n\t\t}\n\n\t\t// Extract only the string values for the API call\n\t\tstringBatch := make([]string, len(params))\n\t\tfor i, paramStr := range params {\n\t\t\tstringBatch[i] = paramStr.OriginalValue\n\t\t}\n\n\t\tembeddings, err := model.EmbedParameters(ctx, stringBatch)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error embedding parameters with model %s: %w\", modelName, err)\n\t\t}\n\n\t\tif len(embeddings) != len(stringBatch) {\n\t\t\treturn nil, fmt.Errorf(\"model %s returned %d embeddings for %d inputs\", modelName, len(embeddings), len(stringBatch))\n\t\t}\n\n\t\tfor i, rawVector := range embeddings {","sourceCodeStart":191,"sourceCodeEnd":227,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/util/parameters/parameters.go#L191-L227","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"# before (name mismatch)\nembeddingModels:\n  myEmbedModel:\n    kind: gemini\ntools:\n  search:\n    kind: mysqldata-sql\n    embeddingModel: my-embed-model\n\n# after (exact match)\nembeddingModels:\n  myEmbedModel:\n    kind: gemini\ntools:\n  search:\n    kind: mysqldata-sql\n    embeddingModel: myEmbedModel","handlingStrategy":"validation","validationCode":"for _, name := range referencedEmbeddingModels {\n    if _, ok := mgr.GetEmbeddingModel(name); !ok {\n        return fmt.Errorf(\"unknown embedding model %q\", name)\n    }\n}","typeGuard":"func embeddingModelExists(mgr *models.Manager, name string) bool {\n    _, ok := mgr.GetEmbeddingModel(name)\n    return ok\n}","tryCatchPattern":"res, err := params.EmbedParams(ctx, pMgr, p)\nif err != nil {\n    if strings.Contains(err.Error(), \"embedding model does not exist\") {\n        // fix config / register model, then retry once\n    }\n    return err\n}","preventionTips":["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."],"tags":["configuration","embeddings","go"],"backgroundTag":"embedding-model-not-found","analyzedSha":"8cc6e09de2ad7b8bffc77751799585a1401a48eb","analyzedAt":"2026-09-05T01:10:36.887Z","contentChangedAt":"2026-09-05T01:10:36.887Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}