github/copilot-sdk · error

runtime package is missing prebuilds/

Error message

runtime package is missing prebuilds/%s/runtime.node: %w

What it means

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.

Solutions

  1. Check the tarball contents (tar -tf pkg.tgz | grep prebuilds) and confirm a runtime.node exists for the resolved platform directory.
  2. 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).
  3. Re-download the tarball if it is corrupt; verify against the published checksum.
  4. 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).

Example fix

// before
bundler --platform linux-x64-musl ...
// package only ships linux-x64-gnu prebuilds

// after
bundler --platform linux-x64-gnu ...
// or upgrade the runtime package that publishes musl prebuilds
Defensive patterns

Strategy: validation

Validate before calling

platform := info.runtimePlatform // e.g. "linux-x64-gnu"
entries, err := listTarball(tarballPath) // tar -tf equivalent
if err != nil {
	return err
}
want := "package/prebuilds/" + platform + "/runtime.node"
found := false
for _, e := range entries {
	if filepath.Clean(e) == want {
		found = true
	}
}
if !found {
	return fmt.Errorf("runtime package does not ship %s; pick a supported platform or package version", want)
}

Type guard

func tarballHasEntry(tarballPath, name string) bool {
	f, err := os.Open(tarballPath)
	if err != nil {
		return false
	}
	defer f.Close()
	gz, err := gzip.NewReader(f)
	if err != nil {
		return false
	}
	defer gz.Close()
	tr := tar.NewReader(gz)
	for {
		hdr, err := tr.Next()
		if err == io.EOF {
			return false
		}
		if err != nil {
			return false
		}
		if filepath.Clean(hdr.Name) == filepath.Clean(name) {
			return true
		}
	}
}

Try / catch

if err := buildBundle(...); err != nil {
	if strings.Contains(err.Error(), "missing prebuilds") {
		var perr *platformError
		if errors.As(err, &perr) {
			log.Errorf("no prebuild for %s; check supported platforms on the runtime package release page", perr.platform)
		}
		return err
	}
	return err
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of github/copilot-sdk@cd8cf15dc3 (2026-09-09). Data as JSON: /api/errors/3c62260bb57cb1be. Report an issue: GitHub.

Appendix: source

Thrown at go/cmd/bundler/main.go:471

		}
	}

	binaryHash, err := sha256File(binaryPath)
	if err != nil {
		return bundleArtifacts{}, fmt.Errorf("failed to hash output binary: %w", err)
	}
	if err := compressZstdFile(binaryPath, outputPath); err != nil {
		return bundleArtifacts{}, fmt.Errorf("failed to write output binary: %w", err)
	}

	rawLibPath := filepath.Join(tempDir, "runtime.node")
	if err := extractFileFromTarball(
		tarballPath,
		tempDir,
		"package/prebuilds/"+info.runtimePlatform+"/runtime.node",
		"runtime.node",
	); err != nil {
		return bundleArtifacts{}, fmt.Errorf("runtime package is missing prebuilds/%s/runtime.node: %w", info.runtimePlatform, err)
	}
	runtimeHash, err := sha256File(rawLibPath)
	if err != nil {
		return bundleArtifacts{}, fmt.Errorf("failed to hash runtime.node: %w", err)
	}
	if err := compressZstdFile(rawLibPath, runtimeArtifactPath); err != nil {
		return bundleArtifacts{}, fmt.Errorf("failed to write runtime.node: %w", err)
	}

	wrapperName := runtimeWrapperName(info.binaryName)
	rawWrapperPath := filepath.Join(tempDir, wrapperName)
	if err := extractFileFromTarball(
		tarballPath,
		tempDir,
		"package/prebuilds/"+info.runtimePlatform+"/"+wrapperName,
		wrapperName,
	); err != nil {
		return bundleArtifacts{}, fmt.Errorf("runtime package is missing prebuilds/%s/%s: %w", info.runtimePlatform, wrapperName, err)

View on GitHub (pinned to cd8cf15dc3)