{"record":{"id":"c6bab9a629e53cb2","repo":"GoogleContainerTools/skaffold","slug":"image-q-context-q-w","errorCode":null,"errorMessage":"image %q context %q: %w","messagePattern":"image %q context %q: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/runner/build.go","lineNumber":158,"sourceCode":"\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":140,"sourceCodeEnd":166,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/runner/build.go#L140-L166","documentation":"Skaffold's CheckWorkspaces validates each build artifact's build context before building. This error wraps the underlying os.Stat error when the artifact's `workspace` path exists in some form but cannot be accessed (e.g. permission denied, too many symlinks). It is wrapped with %w so the original OS error (e.g. 'permission denied') is preserved in the chain.","triggerScenarios":"A build artifact in skaffold.yaml defines `context`/`workspace` pointing to a path where os.Stat fails with an error that is NOT os.IsNotExist — e.g. a directory with no read/execute permission for the current user, or a broken loop of symlinks.","commonSituations":"Cloning a repo on Linux with files owned by another user; running skaffold inside a container where the context directory has restrictive permissions; CI runners dropping privileges before the build.","solutions":["Run `ls -la` on the workspace path and fix permissions (`chmod`/`chown`) so the skaffold process can stat it","If running in a container/CI, mount the context directory with correct ownership and permissions","If the path actually does not exist, fix the `context:` value in skaffold.yaml (that case produces the 'does not exist' variant instead)"],"exampleFix":"// before (skaffold.yaml)\nbuild:\n  artifacts:\n    - image: app\n      context: ./secure-context   # owned by root, mode 0700\n// after\nsudo chown -R $USER ./secure-context && chmod -R u+rx ./secure-context","handlingStrategy":"validation","validationCode":"const ws = artifact.Workspace\ntry {\n  const info = await fs.promises.stat(ws)\n  if (!info.isDirectory()) throw new Error(`${ws} is not a directory`)\n} catch (e) {\n  throw new Error(`workspace ${ws} not accessible: ${e.message}`)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Ensure build context directories are readable/executable by the user running skaffold","Add a preflight `test -d \"$WORKSPACE\"` step in CI before invoking skaffold","Use relative workspace paths committed to the repo rather than user-specific absolute paths"],"tags":["build","filesystem","permissions"],"backgroundTag":"filesystem-permission-denied","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"}