{"record":{"id":"4cc7f56cf39feb8f","repo":"GoogleContainerTools/skaffold","slug":"normalizing-dockerfilepath-path-w","errorCode":null,"errorMessage":"normalizing dockerfilePath path: %w","messagePattern":"normalizing dockerfilePath path: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/docker/dependencies.go","lineNumber":79,"sourceCode":"\trel := filepath.Join(context, dockerfile)\n\tif _, err := os.Stat(rel); os.IsNotExist(err) {\n\t\tif _, err := os.Stat(dockerfile); err == nil || !os.IsNotExist(err) {\n\t\t\treturn filepath.Abs(dockerfile)\n\t\t}\n\t}\n\tif runtime.GOOS == constants.Windows && (filepath.VolumeName(dockerfile) != \"\" || filepath.IsAbs(dockerfile)) {\n\t\treturn dockerfile, nil\n\t}\n\treturn filepath.Abs(rel)\n}\n\n// GetDependencies finds the sources dependency for the given docker artifact.\n// it caches the results for the computed dependency which can be used by `GetDependenciesCached`\n// All paths are relative to the workspace.\nfunc GetDependencies(ctx context.Context, buildCfg BuildConfig, cfg Config) ([]string, error) {\n\tabsDockerfilePath, err := NormalizeDockerfilePath(buildCfg.workspace, buildCfg.dockerfilePath)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"normalizing dockerfilePath path: %w\", err)\n\t}\n\tresult, err := getDependencies(ctx, buildCfg.workspace, buildCfg.dockerfilePath, absDockerfilePath, buildCfg.args, cfg)\n\tdependencyCache.Store(buildCfg.artifact, result, err)\n\treturn result, err\n}\n\n// GetDependencies finds the sources dependency for the given docker artifact.\n// it caches the results for the computed dependency which can be used by `GetDependenciesCached`\n// All paths are relative to the workspace.\nfunc GetDependenciesByDockerCopyFromTo(ctx context.Context, buildCfg BuildConfig, cfg Config) (map[string][]string, error) {\n\tabsDockerfilePath, err := NormalizeDockerfilePath(buildCfg.workspace, buildCfg.dockerfilePath)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"normalizing dockerfilePath path: %w\", err)\n\t}\n\tftToDependencies := getDependenciesByDockerCopyFromTo(ctx, buildCfg.workspace, buildCfg.dockerfilePath, absDockerfilePath, buildCfg.args, cfg)\n\treturn resultPairForDockerCopyFromTo(ftToDependencies)\n}\n","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/docker/dependencies.go#L61-L97","documentation":"GetDependencies wraps a failure from NormalizeDockerfilePath, which resolves the configured dockerfilePath against the workspace to an absolute path (handling relative paths and defaulting to ./Dockerfile). This error means the Dockerfile could not be located or normalized — most often the file simply does not exist at the expected location.","triggerScenarios":"Calling GetDependencies (directly or via sourceDependenciesForArtifact) where NormalizeDockerfilePath fails: dockerfilePath is relative to a non-existent directory, or no Dockerfile exists at the workspace root when dockerfilePath is empty.","commonSituations":"Typo in the dockerfile field of skaffold.yaml; Dockerfile lives in a subdirectory but the path wasn't set; running Skaffold from a different working directory than expected; workspace points at the wrong folder.","solutions":["Verify the file exists: run 'ls <workspace>/<dockerfilePath>' using your skaffold.yaml values.","Set the correct relative dockerfile path in the artifact config: docker: dockerfile: path/to/Dockerfile.","If relying on the default, ensure a 'Dockerfile' exists in the artifact's workspace root.","Check the workspace field points at the directory containing the Dockerfile."],"exampleFix":"// before\nbuild:\n  artifacts:\n    - image: api\n      context: ./services/api   # Dockerfile is in ./services/api/deploy\n// after\nbuild:\n  artifacts:\n    - image: api\n      context: ./services/api\n      docker:\n        dockerfile: deploy/Dockerfile","handlingStrategy":"validation","validationCode":"func assertDockerfile(workspace, dockerfilePath string) error {\n    if dockerfilePath == \"\" {\n        dockerfilePath = \"Dockerfile\"\n    }\n    abs, err := filepath.Abs(filepath.Join(workspace, dockerfilePath))\n    if err != nil {\n        return err\n    }\n    info, err := os.Stat(abs)\n    if err != nil {\n        return fmt.Errorf(\"Dockerfile not found at %s\", abs)\n    }\n    if info.IsDir() {\n        return fmt.Errorf(\"%s is a directory, expected a Dockerfile\", abs)\n    }\n    return nil\n}","typeGuard":"func dockerfileResolvable(workspace, dockerfilePath string) bool {\n    return assertDockerfile(workspace, dockerfilePath) == nil\n}","tryCatchPattern":"deps, err := GetDependencies(ctx, buildCfg, cfg)\nif err != nil {\n    if strings.Contains(err.Error(), \"normalizing dockerfilePath path\") {\n        return fmt.Errorf(\"Dockerfile %q not found under %q — fix docker.dockerfile in skaffold.yaml\", buildCfg.dockerfilePath, buildCfg.workspace)\n    }\n    return err\n}","preventionTips":["Always specify docker.dockerfile explicitly in skaffold.yaml instead of relying on the default.","Run a preflight os.Stat on the resolved Dockerfile path in CI before invoking Skaffold.","Keep Dockerfile paths workspace-relative and consistent with the artifact context.","Add the Dockerfile to version control so refactors don't silently delete it."],"tags":["docker","dockerfile","path"],"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"}