{"record":{"id":"d41a4c27753ab6a5","repo":"github/copilot-sdk","slug":"failed-to-hash-existing-runtime-node-w","errorCode":null,"errorMessage":"failed to hash existing runtime.node: %w","messagePattern":"failed to hash existing runtime\\.node: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/cmd/bundler/main.go","lineNumber":420,"sourceCode":"\t}\n\truntimeArtifactPath := filepath.Join(outputDir, runtimeLibArtifactName(cliVersion, info.runtimePlatform, goos))\n\twrapperArtifactPath := filepath.Join(outputDir, runtimeWrapperArtifactName(cliVersion, info.runtimePlatform, info.binaryName))\n\tassetsArtifactPath := filepath.Join(outputDir, runtimeAssetsArtifactName(cliVersion, info.runtimePlatform))\n\trequiredPaths := []string{outputPath, runtimeArtifactPath, wrapperArtifactPath, assetsArtifactPath}\n\tif includeLicense {\n\t\trequiredPaths = append(requiredPaths, licensePathForOutput(outputPath))\n\t}\n\n\tif filesExist(requiredPaths...) {\n\t\t// Idempotent output avoids re-downloading in CI or local rebuilds.\n\t\tfmt.Printf(\"Output runtime bundle for %s already exists, skipping download\\n\", info.runtimePlatform)\n\t\tbinaryHash, err := sha256FileFromCompressed(outputPath)\n\t\tif err != nil {\n\t\t\treturn bundleArtifacts{}, fmt.Errorf(\"failed to hash existing output: %w\", err)\n\t\t}\n\t\truntimeHash, err := sha256FileFromCompressed(runtimeArtifactPath)\n\t\tif err != nil {\n\t\t\treturn bundleArtifacts{}, fmt.Errorf(\"failed to hash existing runtime.node: %w\", err)\n\t\t}\n\t\twrapperHash, err := sha256FileFromCompressed(wrapperArtifactPath)\n\t\tif err != nil {\n\t\t\treturn bundleArtifacts{}, fmt.Errorf(\"failed to hash existing runtime wrapper: %w\", err)\n\t\t}\n\t\tassetsHash, err := sha256File(assetsArtifactPath)\n\t\tif err != nil {\n\t\t\treturn bundleArtifacts{}, fmt.Errorf(\"failed to hash existing runtime assets: %w\", err)\n\t\t}\n\t\treturn bundleArtifacts{outputPath, binaryHash, runtimeArtifactPath, runtimeHash, wrapperArtifactPath, wrapperHash, assetsArtifactPath, assetsHash}, nil\n\t}\n\n\t// Create temp directory for download\n\ttempDir, err := os.MkdirTemp(\"\", \"copilot-bundler-*\")\n\tif err != nil {\n\t\treturn bundleArtifacts{}, fmt.Errorf(\"failed to create temp dir: %w\", err)\n\t}\n\tdefer os.RemoveAll(tempDir)","sourceCodeStart":402,"sourceCodeEnd":438,"githubUrl":"https://github.com/github/copilot-sdk/blob/cd8cf15dc3f9e762615790aaed0a771a0f392755/go/cmd/bundler/main.go#L402-L438","documentation":"Same idempotent-skip path as the output hash: buildBundle hashes the existing runtime.node artifact with sha256FileFromCompressed and fails if reading it errors. The bundle cannot report consistent hashes without all artifact hashes, so the whole build aborts.","triggerScenarios":"filesExist passed but sha256FileFromCompressed(runtimeArtifactPath) fails — runtime.node deleted after the existence check, permission denied, corrupt/partial file from a prior interrupted run, or decompression failure inside the helper.","commonSituations":"Interrupted previous build left a truncated runtime.node; antivirus or backup tooling locking the file; wrong outputDir reused from a different platform build; permissions changed after first run.","solutions":["Remove the stale runtime.node artifact and rerun to force a clean download.","Check permissions on runtimeArtifactPath.","Ensure no other process is writing/locking the runtime file.","Verify the output directory belongs to the same platform build (don't mix artifact sets).","Check disk space and mount health if read errors persist."],"exampleFix":"// before\nruntimeHash, err := sha256FileFromCompressed(runtimeArtifactPath)\nif err != nil {\n\treturn bundleArtifacts{}, fmt.Errorf(\"failed to hash existing runtime.node: %w\", err)\n}\n// after\nruntimeHash, err := sha256FileFromCompressed(runtimeArtifactPath)\nif err != nil {\n\tif os.IsNotExist(err) {\n\t\t// stale artifact — fall through to re-download\n\t} else {\n\t\treturn bundleArtifacts{}, fmt.Errorf(\"failed to hash existing runtime.node: %w\", err)\n\t}\n}","handlingStrategy":"try-catch","validationCode":"for _, p := range []string{outputPath, runtimeArtifactPath, wrapperArtifactPath, assetsArtifactPath} {\n\tf, err := os.Open(p)\n\tif err != nil { return fmt.Errorf(\"artifact %s unreadable: %w\", p, err) }\n\tf.Close()\n}","typeGuard":null,"tryCatchPattern":"artifacts, err := buildBundle(...)\nif err != nil && strings.Contains(err.Error(), \"runtime.node\") {\n\tos.Remove(runtimeArtifactPath) // drop stale artifact\n\tartifacts, err = buildBundle(...) // retry\n}","preventionTips":["Never mix artifacts from different platform builds in one output dir.","Delete all artifacts together, never selectively.","Check for AV/backup tools locking runtime.node in CI.","Re-run with a clean output dir if hashes fail repeatedly."],"tags":["file-io","hashing","sha256","cache"],"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-16T04:17:20.429Z"}