{"record":{"id":"87863e8be0fdcd77","repo":"hashicorp/nomad","slug":"volume-name-q-cannot-be-a-reserved-word-for-windo","errorCode":null,"errorMessage":"volume name %q cannot be a reserved word for Windows filenames","messagePattern":"volume name %q cannot be a reserved word for Windows filenames","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/docker/win32_volume_parse.go","lineNumber":140,"sourceCode":"\t\t\tsplit = append(split, destination)\n\t\t}\n\t}\n\tif mode, exists := matchgroups[\"mode\"]; exists {\n\t\tif mode != \"\" {\n\t\t\tsplit = append(split, mode)\n\t\t}\n\t}\n\t// Fix #26329. If the destination appears to be a file, and the source is null,\n\t// it may be because we've fallen through the possible naming regex and hit a\n\t// situation where the user intention was to map a file into a container through\n\t// a local volume, but this is not supported by the platform.\n\tif matchgroups[\"source\"] == \"\" && matchgroups[\"destination\"] != \"\" {\n\t\tvolExp := regexp.MustCompile(`^` + rxName + `$`)\n\t\treservedNameExp := regexp.MustCompile(`^` + rxReservedNames + `$`)\n\n\t\tif volExp.MatchString(matchgroups[\"destination\"]) {\n\t\t\tif reservedNameExp.MatchString(matchgroups[\"destination\"]) {\n\t\t\t\treturn nil, fmt.Errorf(\"volume name %q cannot be a reserved word for Windows filenames\", matchgroups[\"destination\"])\n\t\t\t}\n\t\t} else {\n\n\t\t\texists, isDir, _ := currentFileInfoProvider.fileInfo(matchgroups[\"destination\"])\n\t\t\tif exists && !isDir {\n\t\t\t\treturn nil, fmt.Errorf(\"file '%s' cannot be mapped. Only directories can be mapped on this platform\", matchgroups[\"destination\"])\n\n\t\t\t}\n\t\t}\n\t}\n\treturn split, nil\n}\n","sourceCodeStart":122,"sourceCodeEnd":153,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/drivers/docker/win32_volume_parse.go#L122-L153","documentation":"When a Windows bind spec's destination looks like a named volume (a bare name, no path separator), the parser checks it against Windows reserved filenames (CON, PRN, AUX, NUL, COM1..9, LPT1..9). A reserved word is an illegal volume name on Windows, so the spec is rejected before any filesystem access.","triggerScenarios":"windowsSplitRawSpec with a spec like \"CON:C:\\dest\" or \"nul:/data\" where the source/destination matches rxName but also rxReservedNames.","commonSituations":"Volume names chosen carelessly in jobspecs (e.g. testing with \"NUL\"), or a short token that accidentally equals a reserved device name.","solutions":["Rename the volume to a non-resident name (e.g. \"mydata\" instead of \"CON\").","If you meant a host path, add separators/drive letter so it isn't treated as a volume name.","Check against the Windows reserved list: CON, PRN, AUX, NUL, COM1-9, LPT1-9."],"exampleFix":"// before\nvolumes = [\"NUL:C:/data\"]\n// after\nvolumes = [\"appdata:C:/data\"]","handlingStrategy":"validation","validationCode":"var reserved = map[string]bool{\"CON\": true, \"PRN\": true, \"AUX\": true, \"NUL\": true,\n  \"COM1\": true, \"COM2\": true, \"COM3\": true, \"COM4\": true, \"COM5\": true, \"COM6\": true, \"COM7\": true, \"COM8\": true, \"COM9\": true,\n  \"LPT1\": true, \"LPT2\": true, \"LPT3\": true, \"LPT4\": true, \"LPT5\": true, \"LPT6\": true, \"LPT7\": true, \"LPT8\": true, \"LPT9\": true}\nif reserved[strings.ToUpper(volumeName)] {\n  return fmt.Errorf(\"volume name %s is reserved on Windows\", volumeName)\n}","typeGuard":null,"tryCatchPattern":"if err := validateVolumeName(name); err != nil {\n  return fmt.Errorf(\"rename volume in jobspec: %w\", err)\n}","preventionTips":["Use descriptive multi-character names (e.g. appdata) — never DOS device names.","Add a jobspec linter rule rejecting reserved filenames.","Case-insensitive comparison: \"con\" is as invalid as \"CON\"."],"tags":["docker","volumes","windows","naming"],"backgroundTag":"invalid-volume-spec","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"}