{"record":{"id":"da9d105d3a912aa9","repo":"GoogleContainerTools/skaffold","slug":"image-q-context-q-does-not-exist","errorCode":null,"errorMessage":"image %q context %q does not exist","messagePattern":"image %q context %q does not exist","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/runner/build.go","lineNumber":156,"sourceCode":"\tvar bRes []graph.Artifact\n\tfor _, artifact := range artifacts {\n\t\tbRes = append(bRes, graph.Artifact{\n\t\t\tImageName:   artifact.ImageName,\n\t\t\tTag:         tags[artifact.ImageName],\n\t\t\tRuntimeType: artifact.RuntimeType,\n\t\t})\n\t}\n\n\treturn bRes\n}\n\nfunc CheckWorkspaces(artifacts []*latest.Artifact) error {\n\tfor _, a := range artifacts {\n\t\tif a.Workspace != \"\" {\n\t\t\tif info, err := os.Stat(a.Workspace); err != nil {\n\t\t\t\t// err could be permission-related\n\t\t\t\tif os.IsNotExist(err) {\n\t\t\t\t\treturn fmt.Errorf(\"image %q context %q does not exist\", a.ImageName, a.Workspace)\n\t\t\t\t}\n\t\t\t\treturn fmt.Errorf(\"image %q context %q: %w\", a.ImageName, a.Workspace, err)\n\t\t\t} else if !info.IsDir() {\n\t\t\t\treturn fmt.Errorf(\"image %q context %q is not a directory\", a.ImageName, a.Workspace)\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n","sourceCodeStart":138,"sourceCodeEnd":166,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/runner/build.go#L138-L166","documentation":"CheckWorkspaces validates, before building, that every artifact with a non-empty Workspace exists and is a directory. If os.Stat reports the workspace does not exist, this error names both the image and the missing context dir. Distinct messages cover permission errors and non-directory paths.","triggerScenarios":"Build -> CheckWorkspaces: an artifact's Workspace path (build context from skaffold.yaml) does not exist on disk at build time.","commonSituations":"skaffold.yaml context path typo; build context directory not committed / not mounted in CI; path relative to the wrong working directory; artifact generated from profiles pointing at a removed directory.","solutions":["Verify the context path in skaffold.yaml exists relative to the skaffold.yaml location: `ls <context>`","Fix the typo or create the missing directory (with a Dockerfile/source)","If running in CI, ensure the directory is checked out/mounted before build","If the error is permission-related instead, the sibling error will include the OS err — fix chmod accordingly"],"exampleFix":"// before (skaffold.yaml)\nbuild:\n  artifacts:\n    - image: app\n      context: ./backend-service   # directory does not exist\n// after\nbuild:\n  artifacts:\n    - image: app\n      context: ./services/backend","handlingStrategy":"validation","validationCode":"func checkWorkspaces(artifacts []*latest.Artifact) error {\n    for _, a := range artifacts {\n        if a.Workspace == \"\" { continue }\n        fi, err := os.Stat(a.Workspace)\n        if err != nil { return fmt.Errorf(\"missing context %s\", a.Workspace) }\n        if !fi.IsDir() { return fmt.Errorf(\"context %s is not a dir\", a.Workspace) }\n    }\n    return nil\n}\n// call before Build","typeGuard":null,"tryCatchPattern":"if err := CheckWorkspaces(artifacts); err != nil {\n    return fmt.Errorf(\"pre-build check failed: %w\", err)\n}","preventionTips":["Use paths relative to skaffold.yaml for build contexts","Commit all build-context directories (or fetch them in CI) before building","Run CheckWorkspaces-style validation in CI lint before triggering builds"],"tags":["build","workspace","path","skaffold"],"backgroundTag":"build-context-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"}