googleapis/mcp-toolbox · error

invalid double value: %v

Error message

invalid double value: %v

What it means

Type-switch default in JSONToFirestoreValue for doubleValue: the value is not one of float64, int or int64 (e.g. a string or bool tagged as doubleValue), so it cannot be converted to float64.

Source

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

						// Parse string representation using strconv for better performance
						i, err := strconv.ParseInt(strings.TrimSpace(num), 10, 64)
						if err != nil {
							return nil, fmt.Errorf("invalid integer value: %v", val)
						}
						return i, nil
					}
					return nil, fmt.Errorf("invalid integer value: %v", val)
				case "doubleValue":
					// Convert to float64
					switch num := val.(type) {
					case float64:
						return num, nil
					case int:
						return float64(num), nil
					case int64:
						return float64(num), nil
					}
					return nil, fmt.Errorf("invalid double value: %v", val)
				case "bytesValue":
					// Decode base64 string to bytes
					if str, ok := val.(string); ok {
						return base64.StdEncoding.DecodeString(str)
					}
					return nil, fmt.Errorf("bytes value must be a base64 encoded string")
				case "timestampValue":
					// Parse timestamp
					if str, ok := val.(string); ok {
						t, err := time.Parse(time.RFC3339Nano, str)
						if err != nil {
							return nil, fmt.Errorf("invalid timestamp format: %w", err)
						}
						return t, nil
					}
					return nil, fmt.Errorf("timestamp value must be a string")
				case "geoPointValue":
					// Convert to LatLng

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Send doubles as JSON numbers, not strings or booleans
  2. Use the correct value tag (stringValue) if the value is meant to stay textual
Defensive patterns

Strategy: validation

When it happens

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