GoogleContainerTools/skaffold · error
image %q context %q: %w
Error message
image %q context %q: %w
What it means
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.
Source
Thrown at pkg/skaffold/runner/build.go:158
bRes = append(bRes, graph.Artifact{
ImageName: artifact.ImageName,
Tag: tags[artifact.ImageName],
RuntimeType: artifact.RuntimeType,
})
}
return bRes
}
func CheckWorkspaces(artifacts []*latest.Artifact) error {
for _, a := range artifacts {
if a.Workspace != "" {
if info, err := os.Stat(a.Workspace); err != nil {
// err could be permission-related
if os.IsNotExist(err) {
return fmt.Errorf("image %q context %q does not exist", a.ImageName, a.Workspace)
}
return fmt.Errorf("image %q context %q: %w", a.ImageName, a.Workspace, err)
} else if !info.IsDir() {
return fmt.Errorf("image %q context %q is not a directory", a.ImageName, a.Workspace)
}
}
}
return nil
}
View on GitHub (pinned to a1189de023)
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)
Example fix
// before (skaffold.yaml)
build:
artifacts:
- image: app
context: ./secure-context # owned by root, mode 0700
// after
sudo chown -R $USER ./secure-context && chmod -R u+rx ./secure-context Defensive patterns
Strategy: validation
Validate before calling
const ws = artifact.Workspace
try {
const info = await fs.promises.stat(ws)
if (!info.isDirectory()) throw new Error(`${ws} is not a directory`)
} catch (e) {
throw new Error(`workspace ${ws} not accessible: ${e.message}`)
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- writing build output to file: %w
- writing %q to %q: %w
- reading .dockerignore: %w
- walking workspace: %w
- unable to stat file %q: %w
AI-assisted analysis of GoogleContainerTools/skaffold@a1189de023 (2026-09-05).
Data as JSON: /api/errors/c6bab9a629e53cb2.
Report an issue: GitHub.