{"id":"8a060cb455298920","repo":"docker/cli","slug":"got-an-irregular-file","errorCode":null,"errorMessage":"got an irregular file","messagePattern":"got an irregular file","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/command/utils.go","lineNumber":94,"sourceCode":"\t\tif fileInfo.Mode().IsDir() || fileInfo.Mode().IsRegular() {\n\t\t\treturn nil\n\t\t}\n\n\t\tif err := ValidateOutputPathFileMode(fileInfo.Mode()); err != nil {\n\t\t\treturn fmt.Errorf(\"invalid output path: %q must be a directory or a regular file: %w\", path, err)\n\t\t}\n\t}\n\treturn nil\n}\n\n// ValidateOutputPathFileMode validates the output paths of the \"docker cp\" command\n// and serves as a helper to [ValidateOutputPath]\nfunc ValidateOutputPathFileMode(fileMode os.FileMode) error {\n\tswitch {\n\tcase fileMode&os.ModeDevice != 0:\n\t\treturn errors.New(\"got a device\")\n\tcase fileMode&os.ModeIrregular != 0:\n\t\treturn errors.New(\"got an irregular file\")\n\t}\n\treturn nil\n}\n\nfunc invalidParameter(err error) error {\n\treturn invalidParameterErr{err}\n}\n\ntype invalidParameterErr struct{ error }\n\nfunc (invalidParameterErr) InvalidParameter() {}\n\nfunc notFound(err error) error {\n\treturn notFoundErr{err}\n}\n\ntype notFoundErr struct{ error }\n","sourceCodeStart":76,"sourceCodeEnd":112,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/cli/command/utils.go#L76-L112","documentation":"Returned by ValidateOutputPathFileMode for `docker cp` when the destination's file mode has os.ModeIrregular set — a file that is neither regular, directory, symlink, device, pipe, nor socket (platform-specific irregular entries). docker cp cannot safely write archive contents onto such a target, so validation rejects it, wrapped in \"invalid output path: ... must be a directory or a regular file\".","triggerScenarios":"`docker cp <src> <dst>` where os.Stat on the local destination reports ModeIrregular — e.g. certain Windows reparse points, some overlay/union-fs or virtual-filesystem entries — hitting cli/command/utils.go:94.","commonSituations":"Copying onto paths inside unusual mounts (FUSE, WSL interop paths, Windows special reparse points); destination paths generated by scripts that accidentally reference virtual filesystem entries.","solutions":["Choose a destination on a normal filesystem that is a regular file or directory.","Inspect the destination with `ls -la` / `stat` to see what the path actually is, and delete or rename the irregular entry if it's stale.","On Windows/WSL, avoid copying onto reparse points or interop-mounted special paths."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":["docker-cli","docker-cp","filesystem","validation"],"analyzedSha":"e9452d6e785f6e365712b9d71bd7517591773c86","analyzedAt":"2026-08-01T07:09:22.474Z","schemaVersion":2}