googleapis/mcp-toolbox · error
failed to parse orderBy: %w
Error message
failed to parse orderBy: %w
What it means
JSON-decode wrap in parseOrderBy: the orderBy parameter string is not valid JSON, so it cannot be unmarshalled into an OrderByConfig.
Source
Thrown at internal/tools/firestore/firestorequerycollection/firestorequerycollection.go:393
return nil, fmt.Errorf("filter at index %d is invalid: %w", i, err)
}
result = append(result, filter)
}
return result, nil
}
// parseOrderBy parses the orderBy configuration
func (t Tool) parseOrderBy(orderByRaw interface{}) (*OrderByConfig, error) {
orderByJSON, ok := orderByRaw.(string)
if !ok || orderByJSON == "" {
return nil, nil
}
var orderBy OrderByConfig
if err := json.Unmarshal([]byte(orderByJSON), &orderBy); err != nil {
return nil, fmt.Errorf(errOrderByParseFailed, err)
}
if orderBy.Field == "" {
return nil, nil
}
return &orderBy, nil
}
View on GitHub (pinned to 8cc6e09de2)
Solutions
- Send orderBy as a JSON object string like '{"field":"age","direction":"ASCENDING"}'
- Fix JSON syntax errors (quotes, commas, braces)
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at internal/tools/firestore/firestorequerycollection/firestorequerycollection.go:393 when the library encounters an invalid state.
Common situations: See trigger scenarios.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
AI-assisted analysis of googleapis/mcp-toolbox@8cc6e09de2 (2026-09-05).
Data as JSON: /api/errors/87fcab06750e837b.
Report an issue: GitHub.