googleapis/mcp-toolbox · error
bytes value must be a base64 encoded string
Error message
bytes value must be a base64 encoded string
What it means
Type-check guard in JSONToFirestoreValue for bytesValue: the value is not a string, but only a base64-encoded string can be decoded to Firestore bytes.
Source
Thrown at internal/tools/firestore/util/converter.go:82
}
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
if geoMap, ok := val.(map[string]any); ok {
lat, latOk := geoMap["latitude"].(float64)
lng, lngOk := geoMap["longitude"].(float64)
if latOk && lngOk {
return &latlng.LatLng{
Latitude: lat,View on GitHub (pinned to 8cc6e09de2)
Solutions
- Encode the binary payload with standard base64 and send it as a string
- Use stringValue instead if the data is not meant to be bytes
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at internal/tools/firestore/util/converter.go:82 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/0775b349bc513d17.
Report an issue: GitHub.