googleapis/mcp-toolbox · error
failed to parse filter at index %d: %w
Error message
failed to parse filter at index %d: %w
What it means
JSON-decode wrap in parseFilters: the filter string at the given index is not valid JSON, so it cannot be unmarshalled into a FilterConfig.
Source
Thrown at internal/tools/firestore/firestorequerycollection/firestorequerycollection.go:371
filters, ok := filtersRaw.([]any)
if !ok {
return nil, fmt.Errorf(errInvalidFilters, filtersKey)
}
if len(filters) > maxFilterLength {
return nil, fmt.Errorf(errTooManyFilters, len(filters), maxFilterLength)
}
result := make([]FilterConfig, 0, len(filters))
for i, filterRaw := range filters {
filterJSON, ok := filterRaw.(string)
if !ok {
return nil, fmt.Errorf(errFilterNotString, i)
}
var filter FilterConfig
if err := json.Unmarshal([]byte(filterJSON), &filter); err != nil {
return nil, fmt.Errorf(errFilterParseFailed, i, err)
}
if err := filter.Validate(); err != nil {
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
}View on GitHub (pinned to 8cc6e09de2)
Solutions
- Fix the JSON syntax of the filter string (quotes, commas, braces)
- Validate the filter string with a JSON linter before sending
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at internal/tools/firestore/firestorequerycollection/firestorequerycollection.go:371 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/f2207516da7948e1.
Report an issue: GitHub.