googleapis/mcp-toolbox · error
%s is not a valid type of embedding model
Error message
%s is not a valid type of embedding model
What it means
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.
Source
Thrown at internal/server/config.go:443
return nil, fmt.Errorf("`introspectionParamName` is not allowed when `mcpEnabled` is false")
}
if len(actual.ScopesRequired) > 0 {
return nil, fmt.Errorf("`scopesRequired` is not allowed when `mcpEnabled` is false")
}
}
return actual, nil
default:
return nil, fmt.Errorf("%s is not a valid type of auth service", resourceType)
}
}
func UnmarshalYAMLEmbeddingModelConfig(ctx context.Context, name string, r map[string]any) (embeddingmodels.EmbeddingModelConfig, error) {
resourceType, ok := r["type"].(string)
if !ok {
return nil, fmt.Errorf("missing 'type' field or it is not a string")
}
if resourceType != gemini.EmbeddingModelType {
return nil, fmt.Errorf("%s is not a valid type of embedding model", resourceType)
}
dec, err := util.NewStrictDecoder(r)
if err != nil {
return nil, fmt.Errorf("error creating decoder: %s", err)
}
actual := gemini.Config{Name: name}
if err := dec.DecodeContext(ctx, &actual); err != nil {
return nil, fmt.Errorf("unable to parse as %q: %w", name, err)
}
return actual, nil
}
func UnmarshalYAMLToolConfig(ctx context.Context, name string, r map[string]any) (tools.ToolConfig, error) {
err := NameValidation(name)
if err != nil {
return nil, err
}
resourceType, ok := r["type"].(string)View on GitHub (pinned to 8cc6e09de2)
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
Example fix
// before
embeddingModels:
my-embed:
type: openai
model: text-embedding-3-small
// after
embeddingModels:
my-embed:
type: gemini
model: text-embedding-004 Defensive patterns
Strategy: validation
Validate before calling
func validateEmbeddingModelType(cfg map[string]any) error {
t, _ := cfg["type"].(string)
if t != "gemini" { return fmt.Errorf("embedding model type must be 'gemini', got %q", t) }
return nil
} Type guard
func isGeminiEmbedding(cfg map[string]any) bool {
t, ok := cfg["type"].(string)
return ok && t == "gemini"
} Prevention
- 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
When it happens
Trigger: UnmarshalPrimitiveConfig encounters an embeddingModels entry with e.g. `type: openai`, `type: vertex`, `type: gemini-embedding`, or any misspelling of `gemini`.
Common situations: 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.
Related errors
- doc %d: unexpected non-string key in input: %v
- doc %d: invalid config format at key %q: %w
- doc %d: invalid config format at key %q: expected nested for
- %s missing 'kind' field or it is not a string
- missing 'kind' field or it is not a string: %v
AI-assisted analysis of googleapis/mcp-toolbox@8cc6e09de2 (2026-09-05).
Data as JSON: /api/errors/62f3af8228587408.
Report an issue: GitHub.