{"record":{"id":"eb640dd56e182dae","repo":"GoogleContainerTools/skaffold","slug":"computing-the-size-of-the-docker-context-w","errorCode":null,"errorMessage":"computing the size of the Docker context: %w","messagePattern":"computing the size of the Docker context: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/diagnose/diagnose.go","lineNumber":51,"sourceCode":"\ttimeutil \"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/util/time\"\n)\n\ntype Config interface {\n\tdocker.Config\n\n\tGetPipelines() []latest.Pipeline\n\tArtifacts() []*latest.Artifact\n}\n\nfunc CheckArtifacts(ctx context.Context, cfg Config, tags tag.ImageTags, out io.Writer) error {\n\tfor _, p := range cfg.GetPipelines() {\n\t\tfor _, artifact := range p.Build.Artifacts {\n\t\t\toutput.Default.Fprintf(out, \"\\n%s: %s\\n\", typeOfArtifact(artifact), artifact.ImageName)\n\n\t\t\tif artifact.DockerArtifact != nil {\n\t\t\t\tsize, err := sizeOfDockerContext(ctx, artifact, cfg)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"computing the size of the Docker context: %w\", err)\n\t\t\t\t}\n\n\t\t\t\tfmt.Fprintf(out, \" - Size of the context: %vbytes\\n\", size)\n\t\t\t}\n\n\t\t\ttag, ok := tags[artifact.ImageName]\n\t\t\tif !ok {\n\t\t\t\treturn fmt.Errorf(\"getting tag for image %s\", artifact.ImageName)\n\t\t\t}\n\n\t\t\ttimeDeps1, deps, err := timeToListDependencies(ctx, artifact, tag, cfg)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"listing artifact dependencies: %w\", err)\n\t\t\t}\n\t\t\ttimeDeps2, _, err := timeToListDependencies(ctx, artifact, tag, cfg)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"listing artifact dependencies: %w\", err)\n\t\t\t}","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/diagnose/diagnose.go#L33-L69","documentation":"During `skaffold diagnose`, CheckArtifacts measures the size of each Docker artifact's build context by streaming a generated tar context to io.Discard. If creating the tar context or reading it fails, the error is wrapped with this message.","triggerScenarios":"Running `skaffold diagnose` on a pipeline with a Docker artifact where docker.CreateDockerTarContext fails (missing Dockerfile at artifact.DockerfilePath, unreadable workspace files, context exclusion/inclusion errors) or the pipe errors mid-stream.","commonSituations":"Dockerfile path typo in skaffold.yaml; .dockerignore problems; workspace directory deleted or permission-denied; docker build context generation failing due to missing referenced files.","solutions":["Verify the dockerfile path in the artifact's DockerArtifact config relative to the workspace","Check that all files in the workspace referenced by the Dockerfile are readable","Run docker build manually in the workspace to reproduce the context error","Run skaffold diagnose -vdebug to see the underlying 'creating docker context' error"],"exampleFix":"// before (skaffold.yaml)\nbuild:\n  artifacts:\n    - image: app\n      docker:\n        dockerfile: Dockerfile.prod   # missing\n// after\nbuild:\n  artifacts:\n    - image: app\n      docker:\n        dockerfile: Dockerfile","handlingStrategy":"validation","validationCode":"if _, err := os.Stat(filepath.Join(artifact.Workspace, artifact.DockerArtifact.DockerfilePath)); err != nil {\n\treturn fmt.Errorf(\"dockerfile missing: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"if err := diagnose.CheckArtifacts(ctx, cfg, tags, out); err != nil {\n\tvar derr interface{ Unwrap() error }\n\tif errors.As(err, &target) && strings.Contains(err.Error(), \"size of the Docker context\") {\n\t\tlog.Warnf(\"docker context invalid: %v\", err)\n\t}\n}","preventionTips":["Keep Dockerfile path in skaffold.yaml relative and correct","Maintain a correct .dockerignore so the context builds","Verify `docker build .` works in each workspace before diagnosing"],"tags":["skaffold","docker","diagnose"],"backgroundTag":"docker-build-context-failed","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"}