github/copilot-sdk · error
failed to hash runtime wrapper
Error message
failed to hash runtime wrapper: %w
What it means
After extracting the runtime wrapper, buildBundle hashes it with sha256File to record its digest. If the wrapper file cannot be read from the temp directory, the error is wrapped with this message and the bundle aborts. The file was extracted moments earlier, so failures point to silent extraction problems, removal, or I/O errors.
Solutions
- Re-run the bundle and confirm the wrapper file exists and is readable in the temp directory immediately after extraction.
- Exclude the bundler temp directory from antivirus on-access scanning.
- Use a dedicated stable TMPDIR that no scheduled cleaner touches during the build.
- Investigate disk health/space if read errors persist.
Example fix
// before # EDR removes wrapper.node post-extract, hash fails // after # allowlist bundler temp path in EDR EDR_EXCLUDE=/var/tmp/bundler-work bundler ...
Defensive patterns
Strategy: validation
Validate before calling
info, err := os.Stat(rawWrapperPath)
if err != nil {
return fmt.Errorf("wrapper missing at %s after extraction: %w", rawWrapperPath, err)
}
if info.Size() == 0 {
return fmt.Errorf("wrapper at %s is empty; extraction failed", rawWrapperPath)
} Type guard
func fileReadable(path string) bool {
f, err := os.Open(path)
if err != nil {
return false
}
f.Close()
return true
} Try / catch
if err := buildBundle(...); err != nil {
if strings.Contains(err.Error(), "failed to hash runtime wrapper") {
log.Error("wrapper unreadable post-extract; check AV quarantine and temp cleanup")
return err
}
return err
} Prevention
- Allowlist the bundler temp directory in security/AV software.
- Use a dedicated TMPDIR immune to scheduled cleanup jobs.
- Keep wrapper extraction and hashing in the same build step.
- Check disk health and free space on build runners.
When it happens
Trigger: sha256File(rawWrapperPath) errors: wrapper missing from tempDir (cleaner/AV removal), unreadable permissions, or disk I/O failure.
Common situations: Security software quarantining the freshly extracted wrapper library, a concurrent temp cleanup, or failing disk reads on large native artifacts.
Understand the failure class
Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.
Related errors
- failed to hash output binary
- failed to hash runtime.node
- not found at .
- at is empty.
- Filesystem does not support atomic moves; cannot safely…
AI-assisted analysis of github/copilot-sdk@cd8cf15dc3 (2026-09-09).
Data as JSON: /api/errors/c832c203c6fa5e8a.
Report an issue: GitHub.
Appendix: source
Thrown at go/cmd/bundler/main.go:493
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)
}
wrapperHash, err := sha256File(rawWrapperPath)
if err != nil {
return bundleArtifacts{}, fmt.Errorf("failed to hash runtime wrapper: %w", err)
}
if err := compressZstdFile(rawWrapperPath, wrapperArtifactPath); err != nil {
return bundleArtifacts{}, fmt.Errorf("failed to write runtime wrapper: %w", err)
}
if err := createRuntimeAssetsArchive(tarballPath, assetsArtifactPath, info); err != nil {
return bundleArtifacts{}, fmt.Errorf("failed to write runtime assets: %w", err)
}
assetsHash, err := sha256File(assetsArtifactPath)
if err != nil {
return bundleArtifacts{}, fmt.Errorf("failed to hash runtime assets: %w", err)
}
fmt.Printf("Successfully created %s\n", outputPath)
fmt.Printf("Successfully created %s\n", runtimeArtifactPath)
fmt.Printf("Successfully created %s\n", wrapperArtifactPath)
fmt.Printf("Successfully created %s\n", assetsArtifactPath)
return bundleArtifacts{outputPath, binaryHash, runtimeArtifactPath, runtimeHash, wrapperArtifactPath, wrapperHash, assetsArtifactPath, assetsHash}, nil
}View on GitHub (pinned to cd8cf15dc3)