{"record":{"id":"02319334ee8663d5","repo":"github/copilot-sdk","slug":"failed-to-extract-license-w","errorCode":null,"errorMessage":"failed to extract license: %w","messagePattern":"failed to extract license: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/cmd/bundler/main.go","lineNumber":1144,"sourceCode":"func licenseFileName(binaryName string) string {\n\tif strings.HasSuffix(binaryName, \".zst\") {\n\t\treturn strings.TrimSuffix(binaryName, \".zst\") + \".license\"\n\t}\n\treturn binaryName + \".license\"\n}\n\n// extractFileFromTarballStream writes the current tar entry to disk.\nfunc extractFileFromTarballStream(r io.Reader, destDir, outputName string, mode os.FileMode) error {\n\toutPath := filepath.Join(destDir, outputName)\n\toutFile, err := os.OpenFile(outPath, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, mode)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to create output file: %w\", err)\n\t}\n\tif _, err := io.Copy(outFile, r); err != nil {\n\t\tif cerr := outFile.Close(); cerr != nil {\n\t\t\treturn fmt.Errorf(\"failed to extract license: copy error: %v; close error: %w\", err, cerr)\n\t\t}\n\t\treturn fmt.Errorf(\"failed to extract license: %w\", err)\n\t}\n\treturn outFile.Close()\n}\n\n// extractFileFromTarball extracts a single file from a .tgz into destDir with a new name.\nfunc extractFileFromTarball(tarballPath, destDir, targetPath, outputName string) error {\n\tfile, err := os.Open(tarballPath)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer file.Close()\n\n\tgzReader, err := gzip.NewReader(file)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to create gzip reader: %w\", err)\n\t}\n\tdefer gzReader.Close()\n","sourceCodeStart":1126,"sourceCodeEnd":1162,"githubUrl":"https://github.com/github/copilot-sdk/blob/cd8cf15dc3f9e762615790aaed0a771a0f392755/go/cmd/bundler/main.go#L1126-L1162","documentation":"io.Copy failed while streaming the tar entry to the output file, but the subsequent outFile.Close() succeeded. The copy error typically originates from the tar/gzip reader side or a write-side failure during transfer.","triggerScenarios":"extractFileFromTarballStream (from extractCLILicense) encounters a corrupt or truncated tarball (gzip/tar decode error mid-stream) or a disk-full/write error during the copy.","commonSituations":"Partially downloaded release artifact; corrupted CDN copy; interrupted decompression; full disk during bundling.","solutions":["Re-download the tarball and verify its checksum","Test archive integrity manually (gzip -t, tar -tzf)","Check free disk space on the output volume","Retry the bundling operation"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if err := verifyChecksum(tarballPath, expectedSHA256); err != nil { return fmt.Errorf(\"tarball corrupt: %w\", err) }","typeGuard":null,"tryCatchPattern":"if err := extractCLILicense(tarballPath, outputDir); err != nil {\n    if strings.Contains(err.Error(), \"failed to extract license\") {\n        if err2 := verifyChecksum(tarballPath, expectedSHA256); err2 != nil { return fmt.Errorf(\"corrupt tarball, re-download: %w\", err) }\n    }\n    return err\n}","preventionTips":["Validate artifact checksums before extraction","Guarantee free disk space for the extraction target","Retry downloads on checksum mismatch instead of forcing extraction","Keep extraction targets on reliable local storage"],"tags":["go","io-copy","gzip","corruption"],"backgroundTag":"file-write-failed","analyzedSha":"cd8cf15dc3f9e762615790aaed0a771a0f392755","analyzedAt":"2026-09-09T18:32:31.973Z","contentChangedAt":"2026-09-09T18:32:31.973Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}