googleapis/mcp-toolbox · error

error creating decoder: %s

Error message

error creating decoder: %s

What it means

Error "error creating decoder: %s" thrown in googleapis/mcp-toolbox.

Source

Thrown at internal/server/config.go:394

	dec, err := util.NewStrictDecoder(r)
	if err != nil {
		return nil, fmt.Errorf("error creating decoder: %w", err)
	}
	sourceConfig, err := sources.DecodeConfig(ctx, resourceType, name, dec)
	if err != nil {
		return nil, err
	}
	return sourceConfig, nil
}

func UnmarshalYAMLAuthServiceConfig(ctx context.Context, name string, r map[string]any) (auth.AuthServiceConfig, error) {
	resourceType, ok := r["type"].(string)
	if !ok {
		return nil, fmt.Errorf("missing 'type' field or it is not a string")
	}
	dec, err := util.NewStrictDecoder(r)
	if err != nil {
		return nil, fmt.Errorf("error creating decoder: %s", err)
	}

	switch resourceType {
	case google.AuthServiceType:
		actual := google.Config{Name: name}
		if err := dec.DecodeContext(ctx, &actual); err != nil {
			return nil, fmt.Errorf("unable to parse as %s: %w", name, err)
		}
		if !actual.McpEnabled {
			if actual.Audience != "" {
				return nil, fmt.Errorf("`audience` 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
	case generic.AuthServiceType:

View on GitHub (pinned to 8cc6e09de2)

When it happens

Trigger: Thrown at internal/server/config.go:394 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/f5ce083c3d0c591d. Report an issue: GitHub.