{"record":{"id":"3d0da6e92205c4d1","repo":"github/copilot-sdk","slug":"failed-to-hash-runtime-node-w","errorCode":null,"errorMessage":"failed to hash runtime.node: %w","messagePattern":"failed to hash runtime\\.node: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/cmd/bundler/main.go","lineNumber":475,"sourceCode":"\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)\n\t}\n\twrapperHash, err := sha256File(rawWrapperPath)\n\tif err != nil {\n\t\treturn bundleArtifacts{}, fmt.Errorf(\"failed to hash runtime wrapper: %w\", err)","sourceCodeStart":457,"sourceCodeEnd":493,"githubUrl":"https://github.com/github/copilot-sdk/blob/cd8cf15dc3f9e762615790aaed0a771a0f392755/go/cmd/bundler/main.go#L457-L493","documentation":"After extracting runtime.node to the temp directory, buildBundle hashes it with sha256File for the bundle manifest. Failure to open or read the freshly extracted file is wrapped with this message and aborts the bundle. Since the file was just extracted, this usually indicates the extraction silently failed, the file was removed, or an I/O error occurred.","triggerScenarios":"sha256File(rawLibPath) errors on <tempDir>/runtime.node: file missing (removed by cleaner/AV), unreadable permissions, or underlying disk I/O error.","commonSituations":"Antivirus quarantining runtime.node immediately after extraction from the tarball, a temp-dir cleaner racing the build, or disk-full/I/O errors on a large native addon.","solutions":["Verify runtime.node exists and is readable in the temp directory; re-run the build to rule out a transient race.","Exclude the bundler temp directory from antivirus/on-access scanning.","Set TMPDIR to a stable dedicated directory that cleanup jobs do not purge mid-build.","Check disk space and dmesg for I/O errors if the failure is reproducible on reads."],"exampleFix":"// before\nTMPDIR=/tmp bundler ...\n# cleaner purges /tmp mid-build\n\n// after\nmkdir -p /var/tmp/bundler-work\nTMPDIR=/var/tmp/bundler-work bundler ...","handlingStrategy":"validation","validationCode":"info, err := os.Stat(rawLibPath)\nif err != nil {\n\treturn fmt.Errorf(\"runtime.node missing at %s after extraction: %w\", rawLibPath, err)\n}\nif info.Size() < 1024 {\n\treturn fmt.Errorf(\"runtime.node suspiciously small (%d bytes); extraction may be incomplete\", info.Size())\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.node\") {\n\t\tlog.Error(\"runtime.node unreadable post-extract; check AV quarantine and TMPDIR cleanup\")\n\t\treturn err\n\t}\n\treturn err\n}","preventionTips":["Exclude the bundler temp directory from antivirus on-access scanning.","Use a stable dedicated TMPDIR not touched by tmp cleaners.","Keep extract-then-hash in one atomic build step.","Monitor disk health and space on the build machine."],"tags":["hash","sha256","native-addon","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"}