{"record":{"id":"a51fdc6148e2cfa7","repo":"googleapis/mcp-toolbox","slug":"error-creating-decoder-w-a51fdc","errorCode":null,"errorMessage":"error creating decoder: %w","messagePattern":"error creating decoder: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/util/parameters/parameters.go","lineNumber":417,"sourceCode":"\t}\n\n\tparam, err := ParseParameter(ctx, p, typeStr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\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:","sourceCodeStart":399,"sourceCodeEnd":435,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/util/parameters/parameters.go#L399-L435","documentation":"ParseParameter calls util.NewStrictDecoder on the raw parameter map before dispatching on type. This wrapping error fires when strict-decoder construction fails (e.g. the map cannot be marshaled for decoding); the underlying cause is carried via %w. It is a generic guard at the front of parameter decoding, not a type-specific check.","triggerScenarios":"Thrown at internal/util/parameters/parameters.go:417 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the wrapped cause to identify the malformed parameter map","Ensure the parameter entry is a plain YAML mapping with scalar-compatible values"],"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"}