{"record":{"id":"75bafc703d17f44d","repo":"GoogleContainerTools/skaffold","slug":"could-not-write-build-artifacts-w","errorCode":null,"errorMessage":"could not write build-artifacts: %w","messagePattern":"could not write build-artifacts: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/helm/bin.go","lineNumber":157,"sourceCode":"\n\tcleanUp := func() {\n\t\tExec(ctx, h, out, false, nil, \"plugin\", \"uninstall\", helmPluginName)\n\t\tos.RemoveAll(helmPluginDir)\n\t}\n\treturn cleanUp, []string{\"--post-renderer\", helmPluginName}, nil\n}\n\nfunc PrepareSkaffoldFilter(h Client, builds []graph.Artifact, flags []string) (skaffoldBinary string, env []string, cleanup func(), err error) {\n\tskaffoldBinary, err = OSExecutable()\n\tif err != nil {\n\t\treturn \"\", nil, nil, fmt.Errorf(\"cannot locate this Skaffold binary: %w\", err)\n\t}\n\n\tvar buildsFile string\n\tif len(builds) > 0 {\n\t\tbuildsFile, cleanup, err = WriteBuildArtifacts(builds)\n\t\tif err != nil {\n\t\t\treturn \"\", nil, nil, fmt.Errorf(\"could not write build-artifacts: %w\", err)\n\t\t}\n\t}\n\tcmdLine := generateSkaffoldFilter(h, buildsFile, flags)\n\tenv = append(env, fmt.Sprintf(\"SKAFFOLD_CMDLINE=%s\", shell.Join(cmdLine...)))\n\tenv = append(env, fmt.Sprintf(\"SKAFFOLD_FILENAME=%s\", h.ConfigFile()))\n\treturn\n}\n\n// generateSkaffoldFilter creates a \"skaffold filter\" command-line for applying the various\n// Skaffold manifest filters, such a debugging, image replacement, and applying labels.\nfunc generateSkaffoldFilter(h Client, buildsFile string, flags []string) []string {\n\targs := []string{\"filter\", \"--kube-context\", h.KubeContext()}\n\tif h.EnableDebug() {\n\t\targs = append(args, \"--debugging\")\n\t\tfor _, overrideProtocol := range h.OverrideProtocols() {\n\t\t\targs = append(args, fmt.Sprintf(\"--protocols=%s\", overrideProtocol))\n\t\t}\n\t}","sourceCodeStart":139,"sourceCodeEnd":175,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/helm/bin.go#L139-L175","documentation":"After locating the Skaffold binary, PrepareSkaffoldFilter serializes the build artifacts to a temp file that the post-renderer will read. If WriteBuildArtifacts fails (marshal or temp-file I/O), the error is wrapped as \"could not write build-artifacts\".","triggerScenarios":"WriteBuildArtifacts is called with a non-empty builds slice and any of its steps fail: json.Marshal of buildOutputs, os.CreateTemp, write, or close — commonly disk-full, read-only /tmp, or unwritable temp dir.","commonSituations":"Container with a full or read-only /tmp; TMPDIR pointing to a non-writable path; disk quota exceeded in CI; (indirectly) builds containing data that fails to marshal.","solutions":["Check disk space (`df -h /tmp`) and free space or expand the volume","Ensure TMPDIR points to a writable directory, or set TMPDIR explicitly","Verify /tmp is not mounted read-only in the container","Inspect the wrapped cause (marshal vs create vs write) in the error chain for the exact step"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"test -w \"${TMPDIR:-/tmp}\" && df -h \"${TMPDIR:-/tmp}\" | awk 'NR==2{exit ($5+0>=95)?1:0}' || { echo \"temp dir not writable or disk nearly full\"; exit 1; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep /tmp writable with adequate free space in deploy environments","Monitor disk usage in CI before deploy steps","Set TMPDIR to a verified writable directory","Clean stale temp files (builds*.yaml) regularly"],"tags":["helm","temp-file","io","disk"],"backgroundTag":"temp-file-write-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"}