{"record":{"id":"e4f16fe69582c58e","repo":"googleapis/mcp-toolbox","slug":"unable-to-parse-as-q-w-e4f16f","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/util/parameters/parameters.go","lineNumber":423,"sourceCode":"\n\tif err := validateParameter(param); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn param, nil\n}\n\n// ParseParameter parses a raw map into a Parameter object based on its \"type\" field.\nfunc ParseParameter(ctx context.Context, p map[string]any, paramType string) (Parameter, error) {\n\tdec, err := util.NewStrictDecoder(p)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error creating decoder: %w\", err)\n\t}\n\tswitch paramType {\n\tcase TypeString:\n\t\ta := &StringParameter{}\n\t\tif err := dec.DecodeContext(ctx, a); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to parse as %q: %w\", paramType, err)\n\t\t}\n\t\treturn a, nil\n\tcase TypeInt:\n\t\ta := &IntParameter{}\n\t\tif err := dec.DecodeContext(ctx, a); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to parse as %q: %w\", paramType, err)\n\t\t}\n\t\tif a.GetEmbeddedBy() != \"\" {\n\t\t\treturn nil, fmt.Errorf(\"parameter type %q cannot specify 'embeddedBy'\", paramType)\n\t\t}\n\t\treturn a, nil\n\tcase TypeFloat:\n\t\ta := &FloatParameter{}\n\t\tif err := dec.DecodeContext(ctx, a); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to parse as %q: %w\", paramType, err)\n\t\t}\n\t\tif a.GetEmbeddedBy() != \"\" {\n\t\t\treturn nil, fmt.Errorf(\"parameter type %q cannot specify 'embeddedBy'\", paramType)","sourceCodeStart":405,"sourceCodeEnd":441,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/util/parameters/parameters.go#L405-L441","documentation":"ParseParameter dispatches on the 'type' field and strictly decodes the raw map into the matching parameter struct. This wrapping error fires when strict decoding rejects the entry — typically an unknown or misspelled field in the parameter block, since the strict decoder errors on unrecognized keys. The parameter type at fault is named in the message.","triggerScenarios":"Thrown at internal/util/parameters/parameters.go:423 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the wrapped cause for the exact field name rejected by strict decoding","Remove or correct misspelled/unknown fields in the parameter entry","Verify the field is valid for the parameter type indicated in the message"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}