{"record":{"id":"f1cbb629cf7ffd43","repo":"t8y2/dbx","slug":"unsupported-createmode-s","errorCode":null,"errorMessage":"Unsupported createMode: %s","messagePattern":"Unsupported createMode: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agents/drivers/zookeeper/operations.go","lineNumber":181,"sourceCode":"\t}\n\tresult := putResult(stat)\n\tresult[\"key\"] = createdPath\n\tresult[\"createdKey\"] = createdPath\n\treturn result, nil\n}\n\nfunc createFlags(mode string) (int32, error) {\n\tswitch mode {\n\tcase \"\", \"persistent\":\n\t\treturn 0, nil\n\tcase \"ephemeral\":\n\t\treturn zk.FlagEphemeral, nil\n\tcase \"persistent_sequential\":\n\t\treturn zk.FlagSequence, nil\n\tcase \"ephemeral_sequential\":\n\t\treturn zk.FlagEphemeral | zk.FlagSequence, nil\n\tdefault:\n\t\treturn 0, fmt.Errorf(\"Unsupported createMode: %s\", mode)\n\t}\n}\n\nfunc createParents(client znodeClient, parent string) error {\n\tif parent == \"/\" {\n\t\treturn nil\n\t}\n\tcurrent := \"\"\n\tfor _, segment := range strings.Split(strings.Trim(parent, \"/\"), \"/\") {\n\t\tcurrent = childPath(current, segment)\n\t\texists, _, err := client.Exists(current)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif exists {\n\t\t\tcontinue\n\t\t}\n\t\tif _, err := client.Create(current, nil, 0); err != nil && err != zk.ErrNodeExists {","sourceCodeStart":163,"sourceCodeEnd":199,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/zookeeper/operations.go#L163-L199","documentation":"createFlags maps a createMode string to ZooKeeper node flags (ephemeral/sequential bits). Any mode string beyond the four known combinations (persistent, ephemeral, persistent_sequential, ephemeral_sequential) results in this error, so createNode refuses to guess node semantics.","triggerScenarios":"Calling createNode (or the create RPC path) with a createMode like \"ephemeral-sequential\" (hyphen), \"seq\", or any unrecognized token — casing and spelling must match exactly.","commonSituations":"User-supplied mode strings from config or CLI flags, drivers/tools from other ecosystems using different naming conventions (e.g. PERSISTENT_SEQUENTIAL uppercase), or typos in test fixtures.","solutions":["Use one of: \"persistent\", \"ephemeral\", \"persistent_sequential\", \"ephemeral_sequential\".","Normalize user input to lowercase and replace hyphens with underscores before passing it in.","Add a whitelist validation in the caller/UI so invalid modes never reach createNode.","Check the switch in createFlags (operations.go:181) for the authoritative list."],"exampleFix":"// before\ncreateFlags(\"ephemeral-sequential\") // hyphen rejected\n// after\ncreateFlags(\"ephemeral_sequential\")","handlingStrategy":"validation","validationCode":"var validCreateModes = map[string]bool{\n\t\"persistent\": true,\n\t\"ephemeral\": true,\n\t\"persistent_sequential\": true,\n\t\"ephemeral_sequential\": true,\n}\nfunc validCreateMode(m string) bool { return validCreateModes[strings.ToLower(strings.ReplaceAll(m, \"-\", \"_\"))] }","typeGuard":null,"tryCatchPattern":"flags, err := createFlags(mode)\nif err != nil {\n\tif strings.HasPrefix(err.Error(), \"Unsupported createMode:\") {\n\t\treturn nil, fmt.Errorf(\"createMode %q rejected; use persistent|ephemeral|persistent_sequential|ephemeral_sequential\", mode)\n\t}\n\treturn nil, err\n}","preventionTips":["Normalize user input: lowercase, replace hyphens with underscores.","Expose only the four valid modes in UIs/CLI flags.","Centralize createMode values as constants shared by callers and tests."],"tags":["zookeeper","znode","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-14T05:17:10.506Z"}