{"record":{"id":"c832c203c6fa5e8a","repo":"github/copilot-sdk","slug":"failed-to-hash-runtime-wrapper-w","errorCode":null,"errorMessage":"failed to hash runtime wrapper: %w","messagePattern":"failed to hash runtime wrapper: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/cmd/bundler/main.go","lineNumber":493,"sourceCode":"\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)\n\t}\n\twrapperHash, err := sha256File(rawWrapperPath)\n\tif err != nil {\n\t\treturn bundleArtifacts{}, fmt.Errorf(\"failed to hash runtime wrapper: %w\", err)\n\t}\n\tif err := compressZstdFile(rawWrapperPath, wrapperArtifactPath); err != nil {\n\t\treturn bundleArtifacts{}, fmt.Errorf(\"failed to write runtime wrapper: %w\", err)\n\t}\n\tif err := createRuntimeAssetsArchive(tarballPath, assetsArtifactPath, info); err != nil {\n\t\treturn bundleArtifacts{}, fmt.Errorf(\"failed to write runtime assets: %w\", err)\n\t}\n\tassetsHash, err := sha256File(assetsArtifactPath)\n\tif err != nil {\n\t\treturn bundleArtifacts{}, fmt.Errorf(\"failed to hash runtime assets: %w\", err)\n\t}\n\n\tfmt.Printf(\"Successfully created %s\\n\", outputPath)\n\tfmt.Printf(\"Successfully created %s\\n\", runtimeArtifactPath)\n\tfmt.Printf(\"Successfully created %s\\n\", wrapperArtifactPath)\n\tfmt.Printf(\"Successfully created %s\\n\", assetsArtifactPath)\n\treturn bundleArtifacts{outputPath, binaryHash, runtimeArtifactPath, runtimeHash, wrapperArtifactPath, wrapperHash, assetsArtifactPath, assetsHash}, nil\n}","sourceCodeStart":475,"sourceCodeEnd":511,"githubUrl":"https://github.com/github/copilot-sdk/blob/cd8cf15dc3f9e762615790aaed0a771a0f392755/go/cmd/bundler/main.go#L475-L511","documentation":"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.","triggerScenarios":"sha256File(rawWrapperPath) errors: wrapper missing from tempDir (cleaner/AV removal), unreadable permissions, or disk I/O failure.","commonSituations":"Security software quarantining the freshly extracted wrapper library, a concurrent temp cleanup, or failing disk reads on large native artifacts.","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."],"exampleFix":"// before\n# EDR removes wrapper.node post-extract, hash fails\n\n// after\n# allowlist bundler temp path in EDR\nEDR_EXCLUDE=/var/tmp/bundler-work bundler ...","handlingStrategy":"validation","validationCode":"info, err := os.Stat(rawWrapperPath)\nif err != nil {\n\treturn fmt.Errorf(\"wrapper missing at %s after extraction: %w\", rawWrapperPath, err)\n}\nif info.Size() == 0 {\n\treturn fmt.Errorf(\"wrapper at %s is empty; extraction failed\", rawWrapperPath)\n}","typeGuard":"func fileReadable(path string) bool {\n\tf, err := os.Open(path)\n\tif err != nil {\n\t\treturn false\n\t}\n\tf.Close()\n\treturn true\n}","tryCatchPattern":"if err := buildBundle(...); err != nil {\n\tif strings.Contains(err.Error(), \"failed to hash runtime wrapper\") {\n\t\tlog.Error(\"wrapper unreadable post-extract; check AV quarantine and temp cleanup\")\n\t\treturn err\n\t}\n\treturn err\n}","preventionTips":["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."],"tags":["hash","sha256","wrapper","filesystem"],"backgroundTag":"file-read-failed","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"}