t8y2/dbx · error
Unsupported writeMode: %s
Error message
Unsupported writeMode: %s
What it means
The put operation supports a fixed set of writeMode values (e.g. create/overwrite variants). When handed a mode string it does not recognize, put returns this error instead of guessing a default write behavior.
Source
Thrown at agents/drivers/zookeeper/operations.go:144
if err != nil {
return nil, err
}
return putResult(stat), nil
}
if err := createParents(client, parentPath(path)); err != nil {
return nil, err
}
createdPath, err := client.Create(path, data, 0)
if err != nil {
return nil, err
}
_, stat, err := client.Get(createdPath)
if err != nil {
return nil, err
}
return putResult(stat), nil
default:
return nil, fmt.Errorf("Unsupported writeMode: %s", writeMode)
}
}
func createNode(client znodeClient, path string, data []byte, mode string) (map[string]any, error) {
flags, err := createFlags(mode)
if err != nil {
return nil, err
}
if err := createParents(client, parentPath(path)); err != nil {
return nil, err
}
createdPath, err := client.Create(path, data, flags)
if err != nil {
return nil, err
}
_, stat, err := client.Get(createdPath)
if err != nil {
return nil, errView on GitHub (pinned to c0390bff16)
Solutions
- Use one of the writeMode values the driver accepts (inspect the switch in put in operations.go).
- Fix casing/typos — mode strings are compared literally.
- Validate/normalize the mode at the application boundary before calling put.
- If a new mode is genuinely needed, extend the switch in put and its tests.
Example fix
// before put(client, path, data, "upsert") // after put(client, path, data, "overwrite") // accepted mode per operations.go
Defensive patterns
Strategy: validation
Validate before calling
var validWriteModes = map[string]bool{"create": true, "overwrite": true /* per put() in operations.go */}
func validWriteMode(m string) bool { return validWriteModes[m] } Try / catch
res, err := put(client, path, data, mode)
if err != nil {
if strings.HasPrefix(err.Error(), "Unsupported writeMode:") {
return nil, fmt.Errorf("writeMode %q rejected; allowed modes: %v", mode, writeModeList)
}
return nil, err
} Prevention
- Whitelist modes from user/config input against the driver's accepted set.
- Normalize casing and spelling before calling put.
- Keep mode strings in shared constants, not ad-hoc literals.
When it happens
Trigger: Calling put (directly or via dispatch / KV write API) with a writeMode string outside the accepted set — misspelled, wrong casing, or a mode from a different driver's vocabulary.
Common situations: Config-driven write pipelines where the mode comes from user input or YAML config, refactoring that renamed a mode constant, or tests/callers passing "upsert" or "append" which this driver does not implement.
Related errors
- ZooKeeper server list is empty
- ZooKeeper auth scheme and credentials must be configured tog
- Unsupported auth_scheme %q; expected %q or %q
- base_sleep_time_ms must be non-negative
- max_retries must be non-negative
AI-assisted analysis of t8y2/dbx@c0390bff16 (2026-09-05).
Data as JSON: /api/errors/a5f72f8eae0684ef.
Report an issue: GitHub.