{"record":{"id":"67d47f80c71a599f","repo":"github/copilot-sdk","slug":"failed-to-hash-existing-runtime-wrapper-w","errorCode":null,"errorMessage":"failed to hash existing runtime wrapper: %w","messagePattern":"failed to hash existing runtime wrapper: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/cmd/bundler/main.go","lineNumber":424,"sourceCode":"\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)\n\n\tbinaryPath, tarballPath, err := downloadCLIBinary(info.runtimePlatform, info.binaryName, cliVersion, tempDir)\n\tif err != nil {\n\t\treturn bundleArtifacts{}, fmt.Errorf(\"failed to download CLI binary: %w\", err)","sourceCodeStart":406,"sourceCodeEnd":442,"githubUrl":"https://github.com/github/copilot-sdk/blob/cd8cf15dc3f9e762615790aaed0a771a0f392755/go/cmd/bundler/main.go#L406-L442","documentation":"In the skip-existing path of buildBundle, the runtime wrapper artifact is hashed with sha256FileFromCompressed; failure to read it aborts the build. All artifacts must hash successfully for the bundle to be considered valid and reusable.","triggerScenarios":"sha256FileFromCompressed(wrapperArtifactPath) errors after filesExist reported all paths present — wrapper file removed concurrently, unreadable permissions, or corrupt/partial content from an earlier interrupted run.","commonSituations":"Concurrent build/clean racing on the same output dir; wrapper file truncated by a previous crash; output dir on an unreliable network share; permission changes by tooling between runs.","solutions":["Delete stale wrapper artifacts and rerun the bundler.","Check permissions on wrapperArtifactPath.","Serialize builds so only one bundler run owns the output directory.","Exclude the output dir from concurrent clean/AV jobs.","If only the wrapper is bad, restoring just that artifact avoids a full rebuild."],"exampleFix":"// before\nwrapperHash, err := sha256FileFromCompressed(wrapperArtifactPath)\nif err != nil {\n\treturn bundleArtifacts{}, fmt.Errorf(\"failed to hash existing runtime wrapper: %w\", err)\n}\n// after\nwrapperHash, err := sha256FileFromCompressed(wrapperArtifactPath)\nif err != nil {\n\treturn bundleArtifacts{}, fmt.Errorf(\"failed to hash existing runtime wrapper at %s: %w\", wrapperArtifactPath, err)\n}","handlingStrategy":"try-catch","validationCode":"f, err := os.Open(wrapperArtifactPath)\nif err != nil {\n\treturn fmt.Errorf(\"wrapper artifact unreadable: %w\", err)\n}\nf.Close()","typeGuard":null,"tryCatchPattern":"artifacts, err := buildBundle(...)\nif err != nil && strings.Contains(err.Error(), \"runtime wrapper\") {\n\tos.RemoveAll(outputDir)\n\tartifacts, err = buildBundle(...) // full clean rebuild\n}","preventionTips":["Serialize bundler runs with a lock file on the output directory.","Exclude the output dir from concurrent cleanup jobs.","Restore from CI cache only complete artifact sets.","Check permissions after any tooling changes."],"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"}