googleapis/mcp-toolbox · error
error creating decoder: %w
Error message
error creating decoder: %w
What it means
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.
Source
Thrown at internal/util/parameters/parameters.go:417
}
param, err := ParseParameter(ctx, p, typeStr)
if err != nil {
return nil, err
}
if err := validateParameter(param); err != nil {
return nil, err
}
return param, nil
}
// ParseParameter parses a raw map into a Parameter object based on its "type" field.
func ParseParameter(ctx context.Context, p map[string]any, paramType string) (Parameter, error) {
dec, err := util.NewStrictDecoder(p)
if err != nil {
return nil, fmt.Errorf("error creating decoder: %w", err)
}
switch paramType {
case TypeString:
a := &StringParameter{}
if err := dec.DecodeContext(ctx, a); err != nil {
return nil, fmt.Errorf("unable to parse as %q: %w", paramType, err)
}
return a, nil
case TypeInt:
a := &IntParameter{}
if err := dec.DecodeContext(ctx, a); err != nil {
return nil, fmt.Errorf("unable to parse as %q: %w", paramType, err)
}
if a.GetEmbeddedBy() != "" {
return nil, fmt.Errorf("parameter type %q cannot specify 'embeddedBy'", paramType)
}
return a, nil
case TypeFloat:View on GitHub (pinned to 8cc6e09de2)
Solutions
- Inspect the wrapped cause to identify the malformed parameter map
- Ensure the parameter entry is a plain YAML mapping with scalar-compatible values
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at internal/util/parameters/parameters.go:417 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of googleapis/mcp-toolbox@8cc6e09de2 (2026-09-05).
Data as JSON: /api/errors/a51fdc6148e2cfa7.
Report an issue: GitHub.