{"record":{"id":"42bc47170307fa97","repo":"github/copilot-sdk","slug":"runtime-package-contains-no-retained-assets","errorCode":null,"errorMessage":"runtime package contains no retained assets","messagePattern":"runtime package contains no retained assets","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/cmd/bundler/main.go","lineNumber":630,"sourceCode":"\t\t\truntimeWrapperName(info.binaryName),\n\t\t)\n\t\tif !include {\n\t\t\tcontinue\n\t\t}\n\t\toutputHeader := &tar.Header{\n\t\t\tName: destination, Mode: header.Mode, Size: header.Size, Typeflag: tar.TypeReg,\n\t\t\tUid: 0, Gid: 0,\n\t\t}\n\t\tif err := tarWriter.WriteHeader(outputHeader); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif _, err := io.Copy(tarWriter, sourceTar); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tcount++\n\t}\n\tif count == 0 {\n\t\treturn fmt.Errorf(\"runtime package contains no retained assets\")\n\t}\n\tif err := tarWriter.Close(); err != nil {\n\t\treturn err\n\t}\n\treturn gzipWriter.Close()\n}\n\n// runtimeLibExt returns the shared-library extension for the target OS.\nfunc runtimeLibExt(goos string) string {\n\tswitch goos {\n\tcase \"windows\":\n\t\treturn \"dll\"\n\tcase \"darwin\":\n\t\treturn \"dylib\"\n\tdefault:\n\t\treturn \"so\"\n\t}\n}","sourceCodeStart":612,"sourceCodeEnd":648,"githubUrl":"https://github.com/github/copilot-sdk/blob/cd8cf15dc3f9e762615790aaed0a771a0f392755/go/cmd/bundler/main.go#L612-L648","documentation":"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.","triggerScenarios":"The source CLI tarball contains entries but none pass the retention filter (count stays 0), or the tarball itself has no usable entries.","commonSituations":"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.","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"],"exampleFix":"// before\nif count == 0 {\n\treturn fmt.Errorf(\"runtime package contains no retained assets\")\n}\n// after\nif count == 0 {\n\treturn fmt.Errorf(\"runtime package contains no retained assets (source: %s, expected layout mismatch?)\", sourceTarballPath)\n}","handlingStrategy":"validation","validationCode":"out, err := exec.Command(\"tar\", \"-tzf\", tarballPath).Output()\nif err != nil || len(strings.TrimSpace(string(out))) == 0 {\n\treturn fmt.Errorf(\"tarball %s is empty or unreadable\", tarballPath)\n}","typeGuard":"func hasRetainedAssets(entries []string, retain func(string) bool) bool {\n\tfor _, e := range entries {\n\t\tif retain(e) { return true }\n\t}\n\treturn false\n}","tryCatchPattern":"if err := buildBundle(...); err != nil {\n\tif strings.Contains(err.Error(), \"no retained assets\") {\n\t\t// re-download tarball or update retention filter\n\t}\n\treturn err\n}","preventionTips":["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"],"tags":["go","bundler","archive","empty-result"],"backgroundTag":"empty-result-set","analyzedSha":"cd8cf15dc3f9e762615790aaed0a771a0f392755","analyzedAt":"2026-09-09T18:32:31.973Z","contentChangedAt":"2026-09-09T18:32:31.973Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}