t8y2/dbx · error
Unsupported value encoding: %s
Error message
Unsupported value encoding: %s
What it means
decodeValue converts a ZooKeeper node value into raw bytes based on the declared encoding. Only 'utf8' (or empty, meaning plain bytes) and 'base64' are supported; any other Encoding string is rejected with this error. It is a configuration/data validation error, not a network failure.
Source
Thrown at agents/drivers/zookeeper/operations.go:463
func putResult(stat *zk.Stat) map[string]any {
return map[string]any{"version": stat.Version, "mtime": stat.Mtime}
}
func encodeValue(data []byte) valueObject {
if utf8.Valid(data) {
return valueObject{Encoding: "utf8", Data: string(data)}
}
return valueObject{Encoding: "base64", Data: base64.StdEncoding.EncodeToString(data)}
}
func decodeValue(value valueObject) ([]byte, error) {
switch value.Encoding {
case "", "utf8":
return []byte(value.Data), nil
case "base64":
return base64.StdEncoding.DecodeString(value.Data)
default:
return nil, fmt.Errorf("Unsupported value encoding: %s", value.Encoding)
}
}
func encodeCursor(cursor listCursor) (string, error) {
payload, err := json.Marshal(cursor)
if err != nil {
return "", err
}
return base64.StdEncoding.EncodeToString(payload), nil
}
func decodeCursor(value string) (listCursor, error) {
payload, err := base64.StdEncoding.DecodeString(value)
if err != nil {
return listCursor{}, err
}
var cursor listCursor
if err := json.Unmarshal(payload, &cursor); err != nil {View on GitHub (pinned to c0390bff16)
Solutions
- Set the value's Encoding field to "base64" if the Data is base64-encoded.
- Set Encoding to "utf8" (or leave it empty) if Data holds plain bytes.
- Lowercase and normalize the encoding string in your config ("utf8", "base64" are matched exactly, case-sensitively).
- Pre-encode binary data yourself with base64.StdEncoding and mark it as "base64" instead of inventing an encoding.
Example fix
// before
v := Value{Data: "aGVsbG8=", Encoding: "Base64"}
// after
v := Value{Data: "aGVsbG8=", Encoding: "base64"} Defensive patterns
Strategy: validation
Validate before calling
func validEncoding(e string) bool {
switch e {
case "", "utf8", "base64":
return true
}
return false
}
if !validEncoding(v.Encoding) { return fmt.Errorf("unsupported encoding %q", v.Encoding) } Try / catch
data, err := decodeValue(value)
if err != nil {
return fmt.Errorf("decode node value: %w", err)
} Prevention
- Restrict Encoding values to a small typed enum or constants in your codebase.
- Normalize/lowercase encoding strings when loading config.
- Add a unit test covering every encoding string your configs can produce.
When it happens
Trigger: Calling put (which writes via decodeValue) or the path-value cursor path used by TestPathValueCursorAndCreateModes with a value whose Encoding field is set to something other than "", "utf8", or "base64" (e.g. "UTF-8", "hex", "binary").
Common situations: Typos or casing mistakes in config files ("UTF8", "Base64"), copying configs from tools that support extra encodings like hex, or generated payloads where the encoding field was populated programmatically with an unsupported name.
Related errors
- ZooKeeper auth scheme and credentials must be configured tog
- ${name} must be a positive integer
- ZooKeeper server list is empty
- published HiveServer2 configuration has no valid host and po
- Unsupported auth_scheme %q; expected %q or %q
AI-assisted analysis of t8y2/dbx@c0390bff16 (2026-09-05).
Data as JSON: /api/errors/929e719e94b7e2de.
Report an issue: GitHub.