{"record":{"id":"97b0a335839881a2","repo":"goreleaser/goreleaser","slug":"failed-to-make-dir-for-artifact-w","errorCode":null,"errorMessage":"failed to make dir for artifact: %w","messagePattern":"failed to make dir for artifact: %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/pipe/docker/docker.go","lineNumber":255,"sourceCode":"\tif err := gio.Copy(\n\t\tdocker.Dockerfile,\n\t\tfilepath.Join(tmp, \"Dockerfile\"),\n\t); err != nil {\n\t\treturn fmt.Errorf(\"failed to copy dockerfile: %w\", err)\n\t}\n\n\tfor _, file := range docker.Files {\n\t\tif err := os.MkdirAll(filepath.Join(tmp, filepath.Dir(file)), 0o755); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to copy extra file '%s': %w\", file, err)\n\t\t}\n\t\tif err := gio.Copy(file, filepath.Join(tmp, file)); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to copy extra file '%s': %w\", file, err)\n\t\t}\n\t}\n\tfor _, art := range artifacts {\n\t\ttarget := filepath.Join(tmp, art.Name)\n\t\tif err := os.MkdirAll(filepath.Dir(target), 0o755); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to make dir for artifact: %w\", err)\n\t\t}\n\n\t\tif err := gio.Copy(art.Path, target); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to copy artifact: %w\", err)\n\t\t}\n\t}\n\n\tbuildFlags, err := processBuildFlagTemplates(ctx, docker)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlog.Info(\"building docker image\")\n\tif err := dockerBuild(ctx, docker, tmp, images, buildFlags); err != nil {\n\t\tif isFileNotFoundError(err.Error()) {\n\t\t\tvar files []string\n\t\t\t_ = filepath.Walk(tmp, func(_ string, info fs.FileInfo, _ error) error {\n\t\t\t\tif info.IsDir() {","sourceCodeStart":237,"sourceCodeEnd":273,"githubUrl":"https://github.com/goreleaser/goreleaser/blob/f5edd7395693c0c6b501dc722d445d2e86af854d/internal/pipe/docker/docker.go#L237-L273","documentation":"While staging artifacts (binaries, archives) into the Docker build context temp directory, goreleaser calls os.MkdirAll on the artifact's target directory. This error means that directory creation failed, so the artifact cannot be copied in and the docker build cannot proceed. It wraps the underlying OS error.","triggerScenarios":"The artifact's name/path (art.Name) contains a directory prefix whose directories cannot be created in the temp build context, or the temp filesystem is unwritable/full.","commonSituations":"Custom artifact names with nested paths; CI runners with tiny or read-only /tmp; name_template producing paths that conflict with permissions.","solutions":["Inspect the wrapped error to determine if it's a permission, ENOSPC, or path issue.","Ensure artifact names/templates yield simple relative paths without exotic directory components.","Free disk space or point TMPDIR at a writable location and rerun."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"df, err := checkDiskSpace(os.TempDir())\nif err != nil || df.Available < 512*1024*1024 {\n    return errors.New(\"insufficient space in TMPDIR for docker build context\")\n}","typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"failed to make dir for artifact\") {\n    log.Printf(\"temp dir issue: %v\", err) // check permissions/ENOSPC\n}","preventionTips":["Keep artifact names flat (avoid nested directory components in name_template)","Monitor /tmp usage on CI runners","Set TMPDIR to a known-writable volume"],"tags":["docker","filesystem","artifacts"],"backgroundTag":"mkdir-permission-denied","analyzedSha":"f5edd7395693c0c6b501dc722d445d2e86af854d","analyzedAt":"2026-09-05T09:57:18.807Z","contentChangedAt":"2026-09-05T09:57:18.807Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}