{"record":{"id":"6d58572938b1a157","repo":"googleapis/mcp-toolbox","slug":"unable-to-parse-as-q-w","errorCode":null,"errorMessage":"unable to parse as %q: %w","messagePattern":"unable to parse as %q: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/server/config.go","lineNumber":451,"sourceCode":"\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)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"missing 'type' field or it is not a string\")\n\t}\n\t// `authRequired` and `useClientOAuth` cannot be specified together\n\tif r[\"authRequired\"] != nil && r[\"useClientOAuth\"] == true {\n\t\treturn nil, fmt.Errorf(\"`authRequired` and `useClientOAuth` are mutually exclusive. Choose only one authentication method\")\n\t}\n\t// Make `authRequired` an empty list instead of nil for Tool manifest","sourceCodeStart":433,"sourceCodeEnd":469,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/server/config.go#L433-L469","documentation":"The strict decoder rejected the embedding model config body: dec.DecodeContext into gemini.Config failed. This typically means an unknown field (strict mode), a wrong-typed field, or a missing required field inside the embedding model entry.","triggerScenarios":"An embeddingModels entry with `type: gemini` but containing an unrecognized key (strict decoding), a field of the wrong type (e.g. apiVersion: 2), or a required gemini.Config field that failed validation.","commonSituations":"Typos in field names like `apiVersion` -> `apiversion`; pasting LLM-model fields (temperature, etc.) that do not exist on the embedding model config; wrong indentation making a sibling key part of the model entry.","solutions":["Read the wrapped error after 'unable to parse as' for the exact offending field","Remove or rename unknown/misspelled fields — decoding is strict","Compare against the documented gemini embedding model example config"],"exampleFix":"// before\nembeddingModels:\n  my-embed:\n    type: gemini\n    modle: text-embedding-004\n// after\nembeddingModels:\n  my-embed:\n    type: gemini\n    model: text-embedding-004","handlingStrategy":"validation","validationCode":"allowed := map[string]bool{\"type\": true, \"name\": true, \"model\": true, \"apiVersion\": true, \"description\": true}\nfunc checkUnknownFields(cfg map[string]any, allowed map[string]bool) []string {\n  var bad []string\n  for k := range cfg { if !allowed[k] { bad = append(bad, k) } }\n  return bad\n}","typeGuard":null,"tryCatchPattern":"cfg, err := server.UnmarshalYAMLEmbeddingModelConfig(ctx, name, raw)\nif err != nil {\n  log.Printf(\"gemini embedding model %q rejected: %v — check for unknown/misspelled fields\", name, err)\n  return err\n}","preventionTips":["Decoding is strict: remove any field not in the gemini embedding model schema","Match field-name casing exactly (apiVersion, not apiversion)","Validate config against the documented example before startup"],"tags":["config","yaml","validation","strict-decoding"],"backgroundTag":"schema-validation-failed","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"}