{"record":{"id":"3a214527729735e9","repo":"hashicorp/nomad","slug":"invalid-volume-specification-s","errorCode":null,"errorMessage":"invalid volume specification: '%s'","messagePattern":"invalid volume specification: '(.+?)'","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/docker/win32_volume_parse.go","lineNumber":77,"sourceCode":"\t//    -  And can be optional\n\n\t// rxDestination is the regex expression for the mount destination\n\trxDestination = `(?P<destination>((?:\\\\\\\\\\?\\\\)?([a-z]):((?:[\\\\/][^\\\\/:*?\"<>\\r\\n]+)*[\\\\/]?))|(` + rxPipe + `)|([/].*))`\n\n\t// Destination (aka container path):\n\t//    -  Variation on hostdir but can be a drive followed by colon as well\n\t//    -  If a path, must be absolute. Can include spaces\n\t//    -  Drive cannot be c: (explicitly checked in code, not RegEx)\n\n\t// rxMode is the regex expression for the mode of the mount\n\t// Mode (optional):\n\t//    -  Hopefully self explanatory in comparison to above regex's.\n\t//    -  Colon is not in the capture group\n\trxMode = `(:(?P<mode>(?i)ro|rw))?`\n)\n\nfunc errInvalidSpec(spec string) error {\n\treturn fmt.Errorf(\"invalid volume specification: '%s'\", spec)\n}\n\ntype fileInfoProvider interface {\n\tfileInfo(path string) (exist, isDir bool, err error)\n}\n\ntype defaultFileInfoProvider struct {\n}\n\nfunc (defaultFileInfoProvider) fileInfo(path string) (exist, isDir bool, err error) {\n\tfi, err := os.Stat(path)\n\tif err != nil {\n\t\tif !os.IsNotExist(err) {\n\t\t\treturn false, false, err\n\t\t}\n\t\treturn false, false, nil\n\t}\n\treturn true, fi.IsDir(), nil","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/drivers/docker/win32_volume_parse.go#L59-L95","documentation":"errInvalidSpec is the canonical error of the vendored Docker Windows volume parser (windowsSplitRawSpec): the supplied spec matched none of the accepted volume/expression patterns. It names the offending spec verbatim so you can see why the regex parser rejected it.","triggerScenarios":"windowsSplitRawSpec called with a spec that fails rxSplit patterns: invalid drive-letter forms, more than 3 colon-separated fields, illegal characters, or mode other than ro/rw where captured.","commonSituations":"Paths with unquoted spaces, specs like \"C:\\a:D:\\b:extra\", mode typos (\"read-only\"), or UNC paths formatted incorrectly on Windows hosts.","solutions":["Use the exact forms the parser accepts: [drive:]\\path:[drive:]\\path[:ro|rw] or a named volume with destination.","Reduce to at most 3 colon-separated fields; quote/escape paths with spaces before they reach the driver.","Test the spec with `docker run -v \"<spec>\" ...` on Windows to see if Docker itself accepts it."],"exampleFix":"// before\nvolumes = [\"C:/a/b:D:/x/y:read-only\"]\n// after\nvolumes = [\"C:/a/b:D:/x/y:ro\"]","handlingStrategy":"validation","validationCode":"// mirror the accepted patterns before calling the driver\nvar specRe = regexp.MustCompile(`^(?:[A-Za-z]:[\\\\/][^:]*|[A-Za-z0-9][A-Za-z0-9_.-]*):[^:]+(?::(ro|rw))?$`)\nif !specRe.MatchString(spec) {\n  return fmt.Errorf(\"spec %q will be rejected by docker volume parser\", spec)\n}","typeGuard":null,"tryCatchPattern":"if _, err := windowsSplitRawSpec(spec, rxDestination); err != nil {\n  return fmt.Errorf(\"docker rejected %q: %w\", spec, err)\n}","preventionTips":["Limit specs to at most 3 colon-separated fields.","Use ro/rw only for the mode field.","Test tricky specs against `docker run -v` on the target platform first."],"tags":["docker","volumes","windows","parsing"],"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"}