{"record":{"id":"64baf728a0410c13","repo":"hashicorp/nomad","slug":"unknown-mkdir-parameter-q","errorCode":null,"errorMessage":"unknown mkdir parameter: %q","messagePattern":"unknown mkdir parameter: %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/hostvolumemanager/host_volume_plugin.go","lineNumber":192,"sourceCode":"\t}\n\tvar err error\n\n\tfor param, val := range in {\n\t\tswitch param {\n\t\tcase \"mode\":\n\t\t\t// mode needs special treatment - it's octal. note that this does\n\t\t\t// not check whether it's a *reasonable* mode for a directory.\n\t\t\t// that will be discovered during MkdirAll and subsequent usage\n\t\t\t// by workloads (which we cannot predict).\n\t\t\tvar number uint64\n\t\t\tnumber, err = strconv.ParseUint(val, 8, 32)\n\t\t\tout.Mode = os.FileMode(number)\n\t\tcase \"uid\":\n\t\t\tout.Uid, err = strconv.Atoi(val)\n\t\tcase \"gid\":\n\t\t\tout.Gid, err = strconv.Atoi(val)\n\t\tdefault:\n\t\t\terr = fmt.Errorf(\"unknown mkdir parameter: %q\", param)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn out, fmt.Errorf(\"invalid value for %q: %w\", param, err)\n\t\t}\n\t}\n\n\treturn out, nil\n}\n\nfunc (p *HostVolumePluginMkdir) Delete(_ context.Context, req *cstructs.ClientHostVolumeDeleteRequest) error {\n\tpath := filepath.Join(p.VolumesDir, req.ID)\n\tlog := p.log.With(\n\t\t\"operation\", \"delete\",\n\t\t\"volume_id\", req.ID,\n\t\t\"path\", path)\n\tlog.Debug(\"running plugin\")\n\n\terr := os.RemoveAll(path)","sourceCodeStart":174,"sourceCodeEnd":210,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/client/hostvolumemanager/host_volume_plugin.go#L174-L210","documentation":"decodeMkdirParams parses the key/value parameter map passed to the plugin's Create operation into a MkdirParams struct (path, mode, uid, gid). This error is raised when a parameter key outside the recognized set (\"path\", \"mode\", \"uid\", \"gid\") is supplied. It indicates a contract mismatch between the caller building the parameters and the plugin's decoder — usually a typo or a plugin/version where new parameters were added.","triggerScenarios":"Calling Create with a params map containing a key not in {path, mode, uid, gid}, e.g. \"owner\" instead of \"uid\", \"permissions\" instead of \"mode\", or a parameter introduced by a newer Nomad version sent to an older external plugin binary.","commonSituations":"Typo in job/API host volume parameters; custom tooling generating the parameter map; version skew between the Nomad client and an external host volume plugin binary (new parameter names unknown to old plugin).","solutions":["Correct the parameter key to one of the supported names: \"path\", \"mode\", \"uid\", \"gid\".","Check for typos by comparing the keys in your request against the decodeMkdirParams switch cases.","Upgrade the external host volume plugin binary to match the Nomad client version if a newly introduced parameter is being sent.","Log the full parameter map before calling Create to confirm exactly what is passed."],"exampleFix":"// before\nparams := map[string]string{\"path\": \"/vols/data\", \"permissions\": \"0755\"}\n\n// after\nparams := map[string]string{\"path\": \"/vols/data\", \"mode\": \"0755\"}","handlingStrategy":"validation","validationCode":"var allowedMkdirParams = map[string]bool{\"path\": true, \"mode\": true, \"uid\": true, \"gid\": true}\n\nfunc validateMkdirParams(params map[string]string) error {\n    for k := range params {\n        if !allowedMkdirParams[k] {\n            return fmt.Errorf(\"unsupported mkdir parameter %q; allowed: path, mode, uid, gid\", k)\n        }\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"unknown mkdir parameter\") {\n    re := regexp.MustCompile(`unknown mkdir parameter: \"([^\"]+)\"`)\n    if m := re.FindStringSubmatch(err.Error()); m != nil {\n        log.Error(\"remove or rename parameter\", \"param\", m[1])\n    }\n}","preventionTips":["Keep a shared constants file for parameter keys (path/mode/uid/gid) instead of inline strings.","Keep external plugin binaries in lockstep with the Nomad client version.","Unit-test parameter map construction against the decoder's accepted key set.","Log the full params map on failure to spot typos immediately."],"tags":["validation","parameters","host-volumes","go"],"backgroundTag":"invalid-parameter-name","analyzedSha":"482b49bf1aec006f089bcfc7e632d8f6ac303e5e","analyzedAt":"2026-09-04T07:54:14.808Z","contentChangedAt":"2026-09-04T07:54:14.808Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}