{"record":{"id":"2b25cb35985d1130","repo":"GoogleContainerTools/skaffold","slug":"failed-to-write-manifest-to-file-err-w","errorCode":null,"errorMessage":"failed to write manifest to file, err: %w","messagePattern":"failed to write manifest to file, err: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/kubernetes/manifest/url.go","lineNumber":68,"sourceCode":"func downloadFromURL(destDir string, manifest string) (string, error) {\n\tif manifest == \"\" || !util.IsURL(manifest) {\n\t\treturn \"\", fmt.Errorf(\"%s is not a valid URL\", manifest)\n\t}\n\n\tresp, err := http.Get(manifest)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to download manifest from %s, err : %w\", manifest, err)\n\t}\n\tdefer resp.Body.Close()\n\n\tf, err := os.CreateTemp(destDir, \"*.yaml\")\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to create manifest file: %w\", err)\n\t}\n\tdefer f.Close()\n\t_, err = io.Copy(f, resp.Body)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to write manifest to file, err: %w\", err)\n\t}\n\n\treturn f.Name(), nil\n}\n","sourceCodeStart":50,"sourceCodeEnd":73,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/kubernetes/manifest/url.go#L50-L73","documentation":"The downloaded response body is copied into the temp file with io.Copy. Any read/write error mid-transfer (connection dropped, disk full, short write) is wrapped as 'failed to write manifest to file'.","triggerScenarios":"io.Copy(f, resp.Body) returning an error: HTTP connection reset mid-body, context cancellation, or write failures to the temp file (ENOSPC).","commonSituations":"Flaky network or proxy timeouts on large manifests; disk filling up during CI; server closing connection before body completes.","solutions":["Retry the download; check network stability and proxy timeouts","Free disk space if ENOSPC was the cause","Fetch the manifest manually with curl to confirm the server serves the full body"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err != nil {\n    if errors.Is(err, syscall.ENOSPC) {\n        // free disk space before retrying\n    }\n    // otherwise treat as transient network error: retry with backoff\n    return err\n}","preventionTips":["Retry flaky downloads with exponential backoff","Ensure sufficient free disk space for large manifests","Use a reliable mirror/proxy for remote manifests"],"tags":["network","io","download","manifests"],"backgroundTag":"io-copy-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"}