{"record":{"id":"3009019854a931d7","repo":"GoogleContainerTools/skaffold","slug":"creating-tar-gz-w","errorCode":null,"errorMessage":"creating tar gz: %w","messagePattern":"creating tar gz: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/docker/context.go","lineNumber":40,"sourceCode":"\t\"io\"\n\t\"path/filepath\"\n\n\t\"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/util\"\n)\n\nfunc CreateDockerTarContext(ctx context.Context, w io.Writer, buildCfg BuildConfig, cfg Config) error {\n\tpaths, err := GetDependenciesCached(ctx, buildCfg, cfg)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"getting relative tar paths: %w\", err)\n\t}\n\n\tvar p []string\n\tfor _, path := range paths {\n\t\tp = append(p, filepath.Join(buildCfg.workspace, path))\n\t}\n\n\tif err := util.CreateTar(ctx, w, buildCfg.workspace, p); err != nil {\n\t\treturn fmt.Errorf(\"creating tar gz: %w\", err)\n\t}\n\n\treturn nil\n}\n","sourceCodeStart":22,"sourceCodeEnd":45,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/docker/context.go#L22-L45","documentation":"CreateDockerTarContext wraps a failure from util.CreateTar with 'creating tar gz'. After collecting dependency paths, Skaffold streams a tar.gz of those files into the writer; failures here are I/O or archiving problems, not dependency-resolution ones. The wrapped error carries the actual cause (write failure, unreadable file, context cancellation).","triggerScenarios":"Calling CreateDockerTarContext where util.CreateTar fails: the destination writer errors (broken pipe, closed stream), a dependency file is unreadable or was deleted between listing and tarring, or the context is cancelled.","commonSituations":"Disk full when writing downstream; consumer of the writer closed early; a symlinked or permission-restricted file in the build context; very large contexts hitting timeouts; a file listed as a dependency removed by a concurrent build.","solutions":["Read the wrapped error to identify the failing file or write operation.","Check disk space and that the destination of the writer is writable.","Verify all files in the build context are readable (permissions) and exist (no racing deletions).","Retry the build; transient I/O errors (network volumes, flaky mounts) often resolve on retry."],"exampleFix":"null","handlingStrategy":"try-catch","validationCode":"for _, p := range paths {\n    if _, err := os.Stat(filepath.Join(buildCfg.workspace, p)); err != nil {\n        return fmt.Errorf(\"dependency %s missing before tar: %w\", p, err)\n    }\n}","typeGuard":null,"tryCatchPattern":"err := CreateDockerTarContext(ctx, w, buildCfg, cfg)\nif err != nil {\n    if strings.Contains(err.Error(), \"creating tar gz\") {\n        return fmt.Errorf(\"tar creation failed — check disk space, writer availability, and file permissions: %w\", err)\n    }\n    return err\n}","preventionTips":["Ensure adequate disk space for the tar context in build environments.","Keep the writer open and consuming until CreateTar completes (avoid early closes).","Verify read permissions on all build-context files.","Avoid concurrent jobs that mutate the build context while tarring."],"tags":["docker","tar","io"],"backgroundTag":"tar-archive-creation-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"}