github/copilot-sdk · error
runtime package contains no retained assets
Error message
runtime package contains no retained assets
What it means
createRuntimeAssetsArchive errors out when, after copying entries from the source CLI tarball, zero entries were retained. This guards against emitting an empty runtime package that would silently ship a bundle with no assets.
Solutions
- Inspect the source tarball contents (tar -tzf) and compare against the retention filter in createRuntimeAssetsArchive
- Verify the downloaded asset is a genuine release tarball, not an error page or wrong-platform asset
- Update the retention filter to match the current release package layout
- Pin/adjust the CLI version so the package layout matches what the bundler expects
Example fix
// before
if count == 0 {
return fmt.Errorf("runtime package contains no retained assets")
}
// after
if count == 0 {
return fmt.Errorf("runtime package contains no retained assets (source: %s, expected layout mismatch?)", sourceTarballPath)
} Defensive patterns
Strategy: validation
Validate before calling
out, err := exec.Command("tar", "-tzf", tarballPath).Output()
if err != nil || len(strings.TrimSpace(string(out))) == 0 {
return fmt.Errorf("tarball %s is empty or unreadable", tarballPath)
} Type guard
func hasRetainedAssets(entries []string, retain func(string) bool) bool {
for _, e := range entries {
if retain(e) { return true }
}
return false
} Try / catch
if err := buildBundle(...); err != nil {
if strings.Contains(err.Error(), "no retained assets") {
// re-download tarball or update retention filter
}
return err
} Prevention
- List tarball entries and test the retention filter against each new release version
- Verify downloaded assets are real tars (gzip magic bytes), not HTML error pages
- Add a CI check that bundles the pinned version after every release bump
- Keep the retention filter in sync with upstream packaging changes
When it happens
Trigger: The source CLI tarball contains entries but none pass the retention filter (count stays 0), or the tarball itself has no usable entries.
Common situations: Upstream release changed its packaging layout (renamed directories/files) so the retention filter no longer matches; downloaded wrong asset for the platform; tarball was a stub/redirect HTML saved instead of a real tar.
Understand the failure class
Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.
Related errors
- failed to write runtime assets
- failed to hash runtime assets
- SessionFS.InitialWorkingDirectory is required
- SessionFS.SessionStatePath is required
- SessionFS.Conventions must be either 'posix' or 'windows'
AI-assisted analysis of github/copilot-sdk@cd8cf15dc3 (2026-09-09).
Data as JSON: /api/errors/42bc47170307fa97.
Report an issue: GitHub.
Appendix: source
Thrown at go/cmd/bundler/main.go:630
runtimeWrapperName(info.binaryName),
)
if !include {
continue
}
outputHeader := &tar.Header{
Name: destination, Mode: header.Mode, Size: header.Size, Typeflag: tar.TypeReg,
Uid: 0, Gid: 0,
}
if err := tarWriter.WriteHeader(outputHeader); err != nil {
return err
}
if _, err := io.Copy(tarWriter, sourceTar); err != nil {
return err
}
count++
}
if count == 0 {
return fmt.Errorf("runtime package contains no retained assets")
}
if err := tarWriter.Close(); err != nil {
return err
}
return gzipWriter.Close()
}
// runtimeLibExt returns the shared-library extension for the target OS.
func runtimeLibExt(goos string) string {
switch goos {
case "windows":
return "dll"
case "darwin":
return "dylib"
default:
return "so"
}
}View on GitHub (pinned to cd8cf15dc3)