{"record":{"id":"df9169ca3dfe39cd","repo":"GoogleContainerTools/skaffold","slug":"reading-dockerfile-w","errorCode":null,"errorMessage":"reading dockerfile: %w","messagePattern":"reading dockerfile: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/docker/build_args.go","lineNumber":74,"sourceCode":"\t\tdefaults = nonDebugModeArgs\n\t}\n\tresult := map[string]*string{\n\t\t\"SKAFFOLD_RUN_MODE\": util.Ptr(string(mode)),\n\t}\n\tfor k, v := range defaults {\n\t\tresult[k] = &v\n\t}\n\n\tfor k, v := range extra {\n\t\tresult[k] = v\n\t}\n\tabsDockerfilePath, err := NormalizeDockerfilePath(workspace, dockerfilePath)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"normalizing dockerfile path: %w\", err)\n\t}\n\tf, err := os.Open(absDockerfilePath)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"reading dockerfile: %w\", err)\n\t}\n\tdefer f.Close()\n\tresult, err = filterUnusedBuildArgs(f, result)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"removing unused default args: %w\", err)\n\t}\n\tfor k, v := range args {\n\t\tresult[k] = v\n\t}\n\tresult, err = util.EvaluateEnvTemplateMapWithEnv(result, env)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to expand build args: %w\", err)\n\t}\n\treturn result, nil\n}\n\n// ArtifactResolver provides an interface to resolve built artifact tags by image name.\ntype ArtifactResolver interface {","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/docker/build_args.go#L56-L92","documentation":"Fires in evalBuildArgs when the Dockerfile (after path normalization) cannot be opened for reading — most commonly the file does not exist at the resolved path, or permissions deny it. Skaffold reads it to filter build args actually referenced by the Dockerfile.","triggerScenarios":"evalBuildArgs calls os.Open(absDockerfilePath) and the file does not exist, is unreadable by the current user, or is a directory.","commonSituations":"Dockerfile deleted/renamed after config was written; restricted permissions in CI checkout; path pointing at a directory; race where a cleanup step removed the file before build.","solutions":["Confirm the Dockerfile exists at the resolved path (ls the path)","Fix file permissions so the build user can read it","Point docker.dockerfile at the correct file, not a directory","Re-check out / restore the workspace if the file is missing"],"exampleFix":"// before (CI)\n- run: rm -rf deploy/* && skaffold build\n// after\n- run: skaffold build   # don't delete files referenced by docker.dockerfile","handlingStrategy":"validation","validationCode":"abs, err := docker.NormalizeDockerfilePath(workspace, dockerfilePath)\nif err != nil { return err }\nf, err := os.Open(abs)\nif err != nil { return fmt.Errorf(\"dockerfile unreadable: %w\", err) }\nf.Close()","typeGuard":null,"tryCatchPattern":"args, err := evalBuildArgs(workspace, df, args, env)\nif err != nil && strings.Contains(err.Error(), \"reading dockerfile\") {\n  return fmt.Errorf(\"cannot open Dockerfile %s; check existence and permissions: %w\", df, err)\n}","preventionTips":["Don't delete/overwrite the Dockerfile between config validation and build","Grant read permissions on workspace files in CI","Ensure the path is a regular file, not a directory","Avoid build steps that race with Dockerfile cleanup"],"tags":["docker","dockerfile","file-io","permissions"],"backgroundTag":"dockerfile-not-found","analyzedSha":"a1189de023efc32d4b8e11f395acc678aa555011","analyzedAt":"2026-09-05T12:09:27.064Z","contentChangedAt":"2026-09-05T12:09:27.064Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}