github/copilot-sdk · error
license file not found in tarball
Error message
license file not found in tarball
What it means
extractCLILicense iterates all entries of the tarball and only recognizes package/LICENSE.md and package/LICENSE. If it reaches EOF without matching either name, it returns this sentinel error. It means the archive contains no license file at the expected paths.
Solutions
- Inspect the tarball layout (tar -tzf file.tgz) and confirm the license path matches package/LICENSE.md or package/LICENSE
- If the upstream layout changed, update the case labels in extractCLILicense to the new paths
- Verify you are bundling the correct, official release artifact
- Repackage or download a tarball that includes the license
Example fix
// before case "package/LICENSE.md", "package/LICENSE": // after case "package/LICENSE.md", "package/LICENSE", "package/license.md", "package/COPYING":
Defensive patterns
Strategy: validation
Validate before calling
entries, err := listTarball(tarballPath)
if err != nil { return err }
hasLicense := false
for _, e := range entries { if e == "package/LICENSE.md" || e == "package/LICENSE" { hasLicense = true } }
if !hasLicense { return fmt.Errorf("tarball %s lacks package/LICENSE(.md)", tarballPath) } Try / catch
if err := extractCLILicense(tarballPath, outputDir); err != nil {
if strings.Contains(err.Error(), "license file not found") {
log.Printf("no standard license path in %s; skipping or failing loudly", tarballPath)
}
return err
} Prevention
- Inspect release artifact layout (tar -tzf) after every upstream version bump
- Pin the exact artifact version/URL you bundle against
- Verify artifact checksums before extraction
- Keep the recognized license path list in sync with upstream packaging
When it happens
Trigger: extractCLILicense (via buildBundle) is given a tarball whose top-level prefix is not 'package/' (e.g. 'cli-v1.2.0/LICENSE'), the license file has a different name/case (license.txt, LICENCE), or the tarball genuinely has no license entry.
Common situations: Upstream changed the release artifact layout after a version bump; repackaged tarball built with a different root directory name; downloading a custom or nightly build that omits the license.
Understand the failure class
Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.
Related errors
- failed to open release package
- failed to extract CLI license
- failed to create gzip reader
- failed to read tar
- failed to write license
AI-assisted analysis of github/copilot-sdk@cd8cf15dc3 (2026-09-09).
Data as JSON: /api/errors/2f776d3ecdcd39d8.
Report an issue: GitHub.
Appendix: source
Thrown at go/cmd/bundler/main.go:1116
for {
header, err := tarReader.Next()
if err == io.EOF {
break
}
if err != nil {
return fmt.Errorf("failed to read tar: %w", err)
}
switch header.Name {
case "package/LICENSE.md", "package/LICENSE":
licenseName := filepath.Base(licensePath)
if err := extractFileFromTarballStream(tarReader, outputDir, licenseName, os.FileMode(header.Mode)); err != nil {
return fmt.Errorf("failed to write license: %w", err)
}
return nil
}
}
return fmt.Errorf("license file not found in tarball")
}
func licensePathForOutput(outputPath string) string {
if strings.HasSuffix(outputPath, ".zst") {
return strings.TrimSuffix(outputPath, ".zst") + ".license"
}
return outputPath + ".license"
}
func licenseFileName(binaryName string) string {
if strings.HasSuffix(binaryName, ".zst") {
return strings.TrimSuffix(binaryName, ".zst") + ".license"
}
return binaryName + ".license"
}
// extractFileFromTarballStream writes the current tar entry to disk.
func extractFileFromTarballStream(r io.Reader, destDir, outputName string, mode os.FileMode) error {View on GitHub (pinned to cd8cf15dc3)