googleapis/mcp-toolbox · error

invalid array value format

Error message

invalid array value format

What it means

Shape guard in JSONToFirestoreValue for arrayValue: the value is not a map with a `values` array (or is not a map at all), so its elements cannot be enumerated.

Source

Thrown at internal/tools/firestore/util/converter.go:121

						}
					}
					return nil, fmt.Errorf("invalid geopoint value format")
				case "arrayValue":
					// Convert array
					if arrayMap, ok := val.(map[string]any); ok {
						if values, ok := arrayMap["values"].([]any); ok {
							result := make([]any, len(values))
							for i, item := range values {
								converted, err := JSONToFirestoreValue(item, client)
								if err != nil {
									return nil, fmt.Errorf("array item %d: %w", i, err)
								}
								result[i] = converted
							}
							return result, nil
						}
					}
					return nil, fmt.Errorf("invalid array value format")
				case "mapValue":
					// Convert map
					if mapMap, ok := val.(map[string]any); ok {
						if fields, ok := mapMap["fields"].(map[string]any); ok {
							result := make(map[string]any)
							for k, v := range fields {
								converted, err := JSONToFirestoreValue(v, client)
								if err != nil {
									return nil, fmt.Errorf("map field %q: %w", k, err)
								}
								result[k] = converted
							}
							return result, nil
						}
					}
					return nil, fmt.Errorf("invalid map value format")
				case "referenceValue":
					// Convert to DocumentRef if client is provided

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Send arrays as {"values": [<item>, ...]}
  2. Ensure the outer value is a JSON object, not a bare array
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at internal/tools/firestore/util/converter.go:121 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/be28e4118e0fca11. Report an issue: GitHub.