{"record":{"id":"62f3af8228587408","repo":"googleapis/mcp-toolbox","slug":"s-is-not-a-valid-type-of-embedding-model","errorCode":null,"errorMessage":"%s is not a valid type of embedding model","messagePattern":"(.+?) is not a valid type of embedding model","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/server/config.go","lineNumber":443,"sourceCode":"\t\t\t\treturn nil, fmt.Errorf(\"`introspectionParamName` is not allowed when `mcpEnabled` is false\")\n\t\t\t}\n\t\t\tif len(actual.ScopesRequired) > 0 {\n\t\t\t\treturn nil, fmt.Errorf(\"`scopesRequired` is not allowed when `mcpEnabled` is false\")\n\t\t\t}\n\t\t}\n\t\treturn actual, nil\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"%s is not a valid type of auth service\", resourceType)\n\t}\n}\n\nfunc UnmarshalYAMLEmbeddingModelConfig(ctx context.Context, name string, r map[string]any) (embeddingmodels.EmbeddingModelConfig, error) {\n\tresourceType, ok := r[\"type\"].(string)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"missing 'type' field or it is not a string\")\n\t}\n\tif resourceType != gemini.EmbeddingModelType {\n\t\treturn nil, fmt.Errorf(\"%s is not a valid type of embedding model\", resourceType)\n\t}\n\tdec, err := util.NewStrictDecoder(r)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error creating decoder: %s\", err)\n\t}\n\tactual := gemini.Config{Name: name}\n\tif err := dec.DecodeContext(ctx, &actual); err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to parse as %q: %w\", name, err)\n\t}\n\treturn actual, nil\n}\n\nfunc UnmarshalYAMLToolConfig(ctx context.Context, name string, r map[string]any) (tools.ToolConfig, error) {\n\terr := NameValidation(name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tresourceType, ok := r[\"type\"].(string)","sourceCodeStart":425,"sourceCodeEnd":461,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/server/config.go#L425-L461","documentation":"The embedding model entry has a string `type`, but its value is not the only supported embedding model type, gemini.EmbeddingModelType (\"gemini\"). UnmarshalYAMLEmbeddingModelConfig only accepts gemini and rejects all other type strings.","triggerScenarios":"UnmarshalPrimitiveConfig encounters an embeddingModels entry with e.g. `type: openai`, `type: vertex`, `type: gemini-embedding`, or any misspelling of `gemini`.","commonSituations":"Copying an LLM model config (which may allow other providers) into embeddingModels; assuming OpenAI/Vertex embeddings are supported; writing the full model name in `type` instead of using the `model` field.","solutions":["Set `type: gemini` and put the actual model name (e.g. text-embedding-004) in the `model` field","Check docs for the currently supported embedding model types before adding new providers"],"exampleFix":"// before\nembeddingModels:\n  my-embed:\n    type: openai\n    model: text-embedding-3-small\n// after\nembeddingModels:\n  my-embed:\n    type: gemini\n    model: text-embedding-004","handlingStrategy":"validation","validationCode":"func validateEmbeddingModelType(cfg map[string]any) error {\n  t, _ := cfg[\"type\"].(string)\n  if t != \"gemini\" { return fmt.Errorf(\"embedding model type must be 'gemini', got %q\", t) }\n  return nil\n}","typeGuard":"func isGeminiEmbedding(cfg map[string]any) bool {\n  t, ok := cfg[\"type\"].(string)\n  return ok && t == \"gemini\"\n}","tryCatchPattern":null,"preventionTips":["Remember gemini is currently the only embedding model type; put the model name in 'model'","Do not reuse LLM provider configs for embeddingModels","Verify against docs for the toolbox version in use"],"tags":["config","yaml","embedding","validation"],"backgroundTag":"invalid-config-type","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"}