{"id":"3c092346d70a4c9e","repo":"docker/cli","slug":"bad-format-for-path-s","errorCode":null,"errorMessage":"bad format for path: %s","messagePattern":"bad format for path: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/command/container/opts.go","lineNumber":1098,"sourceCode":"\t\t// Windows does validation entirely server-side\n\t\treturn val, nil\n\t}\n\treturn \"\", fmt.Errorf(\"unknown server OS: %s\", serverOS)\n}\n\n// validateLinuxPath is the implementation of validateDevice knowing that the\n// target server operating system is a Linux daemon.\n// It will make sure 'val' is in the form:\n//\n//\t[host-dir:]container-path[:mode]\n//\n// It also validates the device mode.\nfunc validateLinuxPath(val string, validator func(string) bool) (string, error) {\n\tvar containerPath string\n\tvar mode string\n\n\tif strings.Count(val, \":\") > 2 {\n\t\treturn val, fmt.Errorf(\"bad format for path: %s\", val)\n\t}\n\n\tsplit := strings.SplitN(val, \":\", 3)\n\tif split[0] == \"\" {\n\t\treturn val, fmt.Errorf(\"bad format for path: %s\", val)\n\t}\n\tswitch len(split) {\n\tcase 1:\n\t\tcontainerPath = split[0]\n\t\tval = path.Clean(containerPath)\n\tcase 2:\n\t\tif isValid := validator(split[1]); isValid {\n\t\t\tcontainerPath = split[0]\n\t\t\tmode = split[1]\n\t\t\tval = fmt.Sprintf(\"%s:%s\", path.Clean(containerPath), mode)\n\t\t} else {\n\t\t\tcontainerPath = split[1]\n\t\t\tval = fmt.Sprintf(\"%s:%s\", split[0], path.Clean(containerPath))","sourceCodeStart":1080,"sourceCodeEnd":1116,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/cli/command/container/opts.go#L1080-L1116","documentation":"Error \"bad format for path: %s\" thrown in docker/cli.","triggerScenarios":"Thrown at cli/command/container/opts.go:1098 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"e9452d6e785f6e365712b9d71bd7517591773c86","analyzedAt":"2026-08-01T07:09:22.474Z","schemaVersion":2}