{"record":{"id":"e9b967f5cb4b2802","repo":"googleapis/mcp-toolbox","slug":"filter-at-index-d-is-not-a-string","errorCode":null,"errorMessage":"filter at index %d is not a string","messagePattern":"filter at index (.+?) is not a string","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/tools/firestore/firestorequerycollection/firestorequerycollection.go","lineNumber":366,"sourceCode":"\treturn result, nil\n}\n\n// parseFilters parses and validates filter configurations\nfunc (t Tool) parseFilters(filtersRaw interface{}) ([]FilterConfig, error) {\n\tfilters, ok := filtersRaw.([]any)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(errInvalidFilters, filtersKey)\n\t}\n\n\tif len(filters) > maxFilterLength {\n\t\treturn nil, fmt.Errorf(errTooManyFilters, len(filters), maxFilterLength)\n\t}\n\n\tresult := make([]FilterConfig, 0, len(filters))\n\tfor i, filterRaw := range filters {\n\t\tfilterJSON, ok := filterRaw.(string)\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(errFilterNotString, i)\n\t\t}\n\n\t\tvar filter FilterConfig\n\t\tif err := json.Unmarshal([]byte(filterJSON), &filter); err != nil {\n\t\t\treturn nil, fmt.Errorf(errFilterParseFailed, i, err)\n\t\t}\n\n\t\tif err := filter.Validate(); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"filter at index %d is invalid: %w\", i, err)\n\t\t}\n\n\t\tresult = append(result, filter)\n\t}\n\n\treturn result, nil\n}\n\n// parseOrderBy parses the orderBy configuration","sourceCodeStart":348,"sourceCodeEnd":384,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/firestore/firestorequerycollection/firestorequerycollection.go#L348-L384","documentation":"Element-type guard in parseFilters: an entry of the filters array is not a string. Each filter must arrive as a JSON-encoded string, not a raw object or number.","triggerScenarios":"Thrown at internal/tools/firestore/firestorequerycollection/firestorequerycollection.go:366 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["JSON-encode each filter object into a string before sending","Do not mix raw objects into the filters array"],"exampleFix":null,"handlingStrategy":"validation","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"}