{"record":{"id":"3c62260bb57cb1be","repo":"github/copilot-sdk","slug":"runtime-package-is-missing-prebuilds-s-runtime-no","errorCode":null,"errorMessage":"runtime package is missing prebuilds/%s/runtime.node: %w","messagePattern":"runtime package is missing prebuilds/(.+?)/runtime\\.node: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/cmd/bundler/main.go","lineNumber":471,"sourceCode":"\t\t}\n\t}\n\n\tbinaryHash, err := sha256File(binaryPath)\n\tif err != nil {\n\t\treturn bundleArtifacts{}, fmt.Errorf(\"failed to hash output binary: %w\", err)\n\t}\n\tif err := compressZstdFile(binaryPath, outputPath); err != nil {\n\t\treturn bundleArtifacts{}, fmt.Errorf(\"failed to write output binary: %w\", err)\n\t}\n\n\trawLibPath := filepath.Join(tempDir, \"runtime.node\")\n\tif err := extractFileFromTarball(\n\t\ttarballPath,\n\t\ttempDir,\n\t\t\"package/prebuilds/\"+info.runtimePlatform+\"/runtime.node\",\n\t\t\"runtime.node\",\n\t); err != nil {\n\t\treturn bundleArtifacts{}, fmt.Errorf(\"runtime package is missing prebuilds/%s/runtime.node: %w\", info.runtimePlatform, err)\n\t}\n\truntimeHash, err := sha256File(rawLibPath)\n\tif err != nil {\n\t\treturn bundleArtifacts{}, fmt.Errorf(\"failed to hash runtime.node: %w\", err)\n\t}\n\tif err := compressZstdFile(rawLibPath, runtimeArtifactPath); err != nil {\n\t\treturn bundleArtifacts{}, fmt.Errorf(\"failed to write runtime.node: %w\", err)\n\t}\n\n\twrapperName := runtimeWrapperName(info.binaryName)\n\trawWrapperPath := filepath.Join(tempDir, wrapperName)\n\tif err := extractFileFromTarball(\n\t\ttarballPath,\n\t\ttempDir,\n\t\t\"package/prebuilds/\"+info.runtimePlatform+\"/\"+wrapperName,\n\t\twrapperName,\n\t); err != nil {\n\t\treturn bundleArtifacts{}, fmt.Errorf(\"runtime package is missing prebuilds/%s/%s: %w\", info.runtimePlatform, wrapperName, err)","sourceCodeStart":453,"sourceCodeEnd":489,"githubUrl":"https://github.com/github/copilot-sdk/blob/cd8cf15dc3f9e762615790aaed0a771a0f392755/go/cmd/bundler/main.go#L453-L489","documentation":"buildBundle extracts the platform-native runtime.node addon from the downloaded npm tarball at package/prebuilds/<runtimePlatform>/runtime.node. If that extraction fails — most commonly because the prebuilt binary for the target platform is not present in the archive — the error is wrapped with this message, naming the platform directory it looked in.","triggerScenarios":"extractFileFromTarball(tarballPath, tempDir, \"package/prebuilds/\"+info.runtimePlatform+\"/runtime.node\", ...) errors: the tarball has no prebuilds/<platform>/runtime.node entry for the resolved platform, or the tarball itself is unreadable/corrupt.","commonSituations":"Bundling for a platform the runtime npm package does not ship prebuilds for (e.g. musl/alpine, armv7, freebsd), pinning an older/newer runtime package version that changed the prebuilds layout, or a platform string mismatch between the bundler target and the package's napi prebuild names.","solutions":["Check the tarball contents (tar -tf pkg.tgz | grep prebuilds) and confirm a runtime.node exists for the resolved platform directory.","Bundle a platform the package officially ships prebuilds for, or install/use a runtime package version that publishes prebuilds for your target (check its releases/CI matrix).","Re-download the tarball if it is corrupt; verify against the published checksum.","If the platform string is being set via flags/env, confirm it matches the package's prebuild directory naming exactly (e.g. linux-x64-gnu vs linux-x64-musl)."],"exampleFix":"// before\nbundler --platform linux-x64-musl ...\n// package only ships linux-x64-gnu prebuilds\n\n// after\nbundler --platform linux-x64-gnu ...\n// or upgrade the runtime package that publishes musl prebuilds","handlingStrategy":"validation","validationCode":"platform := info.runtimePlatform // e.g. \"linux-x64-gnu\"\nentries, err := listTarball(tarballPath) // tar -tf equivalent\nif err != nil {\n\treturn err\n}\nwant := \"package/prebuilds/\" + platform + \"/runtime.node\"\nfound := false\nfor _, e := range entries {\n\tif filepath.Clean(e) == want {\n\t\tfound = true\n\t}\n}\nif !found {\n\treturn fmt.Errorf(\"runtime package does not ship %s; pick a supported platform or package version\", want)\n}","typeGuard":"func tarballHasEntry(tarballPath, name string) bool {\n\tf, err := os.Open(tarballPath)\n\tif err != nil {\n\t\treturn false\n\t}\n\tdefer f.Close()\n\tgz, err := gzip.NewReader(f)\n\tif err != nil {\n\t\treturn false\n\t}\n\tdefer gz.Close()\n\ttr := tar.NewReader(gz)\n\tfor {\n\t\thdr, err := tr.Next()\n\t\tif err == io.EOF {\n\t\t\treturn false\n\t\t}\n\t\tif err != nil {\n\t\t\treturn false\n\t\t}\n\t\tif filepath.Clean(hdr.Name) == filepath.Clean(name) {\n\t\t\treturn true\n\t\t}\n\t}\n}","tryCatchPattern":"if err := buildBundle(...); err != nil {\n\tif strings.Contains(err.Error(), \"missing prebuilds\") {\n\t\tvar perr *platformError\n\t\tif errors.As(err, &perr) {\n\t\t\tlog.Errorf(\"no prebuild for %s; check supported platforms on the runtime package release page\", perr.platform)\n\t\t}\n\t\treturn err\n\t}\n\treturn err\n}","preventionTips":["Check the runtime npm package's prebuilds/ listing (tar -tf) for your target before bundling.","Pin to runtime package versions that publish prebuilds for all platforms you target (check the release CI matrix).","Match the platform string exactly to the package's directory naming (gnu vs musl, arch variants).","Re-download and checksum-verify the tarball if a previously working platform suddenly fails."],"tags":["prebuilds","native-addon","tarball","platform"],"backgroundTag":"resource-not-found","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"}