{"record":{"id":"ecd8889d0173406e","repo":"docker/cli","slug":"too-many-colons","errorCode":null,"errorMessage":"too many colons","messagePattern":"too many colons","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/volumespec/volumespec.go","lineNumber":72,"sourceCode":"}\n\nfunc populateFieldFromBuffer(char rune, buffer []rune, volume *VolumeConfig) error {\n\tstrBuffer := string(buffer)\n\tswitch {\n\tcase len(buffer) == 0:\n\t\treturn errors.New(\"empty section between colons\")\n\t// Anonymous volume\n\tcase volume.Source == \"\" && char == endOfSpec:\n\t\tvolume.Target = strBuffer\n\t\treturn nil\n\tcase volume.Source == \"\":\n\t\tvolume.Source = strBuffer\n\t\treturn nil\n\tcase volume.Target == \"\":\n\t\tvolume.Target = strBuffer\n\t\treturn nil\n\tcase char == ':':\n\t\treturn errors.New(\"too many colons\")\n\t}\n\tfor option := range strings.SplitSeq(strBuffer, \",\") {\n\t\tswitch option {\n\t\tcase \"ro\":\n\t\t\tvolume.ReadOnly = true\n\t\tcase \"rw\":\n\t\t\tvolume.ReadOnly = false\n\t\tcase \"nocopy\":\n\t\t\tvolume.Volume = &VolumeOpts{NoCopy: true}\n\t\tdefault:\n\t\t\tif isBindOption(option) {\n\t\t\t\tvolume.Bind = &BindOpts{Propagation: option}\n\t\t\t}\n\t\t\t// ignore unknown options\n\t\t}\n\t}\n\treturn nil\n}","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/docker/cli/blob/4f84911bfe8811e9b028e4b1fee8e7510be79387/internal/volumespec/volumespec.go#L54-L90","documentation":"Returned by populateFieldFromBuffer (internal/volumespec/volumespec.go:72) when a third colon is encountered in the volume spec after source and target have already been populated. Docker volume specs support at most three colon-separated segments (source:target:options); encountering a fourth delimiter is invalid.","triggerScenarios":"volumespec.Parse is called with a spec containing more than two colons in a meaningful position, e.g., '/a:/b:ro:extra'. After source, target, and options are set, the parser encounters another ':' and returns this error.","commonSituations":"Typo adding extra colons, misunderstanding the volume spec format (attempting to specify multiple option groups with colons instead of commas), Windows drive letters interacting with colon parsing in unexpected ways.","solutions":["Reduce to at most three colon-separated segments: source:target:options.","Use commas within the options segment instead of colons for multiple options (e.g., 'src:dst:ro,nocopy' not 'src:dst:ro:nocopy')."],"exampleFix":"// before: too many colons\n// docker run -v /a:/b:ro:nocopy nginx\n\n// after: comma-separated options\n// docker run -v /a:/b:ro,nocopy nginx","handlingStrategy":"validation","validationCode":"func validateVolumeColonCount(spec string) error {\n    // Windows drive letters (e.g., C:) are handled by the parser, but\n    // a spec with more than 2 meaningful colons is invalid.\n    if strings.Count(spec, \":\") > 3 {\n        return fmt.Errorf(\"too many colons in volume spec: %s (max source:target:options)\", spec)\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":"vol, err := volumespec.Parse(spec)\nif err != nil {\n    if err.Error() == \"too many colons\" {\n        return fmt.Errorf(\"volume spec %q has too many colons; use format source:target:options with comma-separated options\", spec)\n    }\n    return err\n}","preventionTips":["Limit volume specs to at most three colon-separated segments: source:target:options.","Use commas within the options segment for multiple options (e.g., ro,nocopy).","Be aware that Windows drive letters (C:) are treated specially by the parser."],"tags":["volume","validation","parse","mount"],"backgroundTag":null,"analyzedSha":"4f84911bfe8811e9b028e4b1fee8e7510be79387","analyzedAt":"2026-08-07T12:15:29.814Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}