{"record":{"id":"a5f72f8eae0684ef","repo":"t8y2/dbx","slug":"unsupported-writemode-s","errorCode":null,"errorMessage":"Unsupported writeMode: %s","messagePattern":"Unsupported writeMode: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agents/drivers/zookeeper/operations.go","lineNumber":144,"sourceCode":"\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn putResult(stat), nil\n\t\t}\n\t\tif err := createParents(client, parentPath(path)); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tcreatedPath, err := client.Create(path, data, 0)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\t_, stat, err := client.Get(createdPath)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn putResult(stat), nil\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"Unsupported writeMode: %s\", writeMode)\n\t}\n}\n\nfunc createNode(client znodeClient, path string, data []byte, mode string) (map[string]any, error) {\n\tflags, err := createFlags(mode)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif err := createParents(client, parentPath(path)); err != nil {\n\t\treturn nil, err\n\t}\n\tcreatedPath, err := client.Create(path, data, flags)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t_, stat, err := client.Get(createdPath)\n\tif err != nil {\n\t\treturn nil, err","sourceCodeStart":126,"sourceCodeEnd":162,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/zookeeper/operations.go#L126-L162","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nput(client, path, data, \"upsert\")\n// after\nput(client, path, data, \"overwrite\") // accepted mode per operations.go","handlingStrategy":"validation","validationCode":"var validWriteModes = map[string]bool{\"create\": true, \"overwrite\": true /* per put() in operations.go */}\nfunc validWriteMode(m string) bool { return validWriteModes[m] }","typeGuard":null,"tryCatchPattern":"res, err := put(client, path, data, mode)\nif err != nil {\n\tif strings.HasPrefix(err.Error(), \"Unsupported writeMode:\") {\n\t\treturn nil, fmt.Errorf(\"writeMode %q rejected; allowed modes: %v\", mode, writeModeList)\n\t}\n\treturn nil, err\n}","preventionTips":["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."],"tags":["zookeeper","kv","validation"],"backgroundTag":"unsupported-enum-value","analyzedSha":"c0390bff16418b651f4728520d99adf8ce48829a","analyzedAt":"2026-09-05T23:05:10.900Z","contentChangedAt":"2026-09-05T23:05:10.900Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}