{"record":{"id":"71676825905f4e8d","repo":"github/copilot-sdk","slug":"failed-to-hash-runtime-assets-w","errorCode":null,"errorMessage":"failed to hash runtime assets: %w","messagePattern":"failed to hash runtime assets: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/cmd/bundler/main.go","lineNumber":503,"sourceCode":"\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}\n\nfunc filesExist(paths ...string) bool {\n\tfor _, path := range paths {\n\t\tif _, err := os.Stat(path); err != nil {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}\n","sourceCodeStart":485,"sourceCodeEnd":521,"githubUrl":"https://github.com/github/copilot-sdk/blob/cd8cf15dc3f9e762615790aaed0a771a0f392755/go/cmd/bundler/main.go#L485-L521","documentation":"This error wraps a failure from sha256File when hashing the freshly created runtime assets archive. The bundler computes the SHA-256 digest to embed in bundle metadata; if the file cannot be opened or read, buildBundle fails with this message.","triggerScenarios":"sha256File(assetsArtifactPath) returns an error right after createRuntimeAssetsArchive succeeds — typically the assets file is missing/unreadable or an I/O error occurs while reading it.","commonSituations":"Antivirus or another process removing temp files between creation and hashing; disk read errors; permissions changed on the output directory; filesystem race in a shared tmpdir.","solutions":["Re-run the bundler; transient read errors usually clear on retry","Confirm the assets artifact path exists and is readable in the output directory (ls -l)","Check disk health / available space on the output volume","Log the wrapped cause (%w) to distinguish open failures from read failures"],"exampleFix":"// before\nassetsHash, err := sha256File(assetsArtifactPath)\nif err != nil {\n\treturn bundleArtifacts{}, fmt.Errorf(\"failed to hash runtime assets: %w\", err)\n}\n// after\nassetsHash, err := sha256File(assetsArtifactPath)\nif err != nil {\n\tif os.IsNotExist(err) {\n\t\treturn bundleArtifacts{}, fmt.Errorf(\"runtime assets missing at %s: %w\", assetsArtifactPath, err)\n\t}\n\treturn bundleArtifacts{}, fmt.Errorf(\"failed to hash runtime assets: %w\", err)\n}","handlingStrategy":"try-catch","validationCode":"if fi, err := os.Stat(assetsArtifactPath); err != nil || fi.Size() == 0 {\n\treturn fmt.Errorf(\"assets artifact %s missing or empty before hashing\", assetsArtifactPath)\n}","typeGuard":null,"tryCatchPattern":"assetsHash, err := sha256File(assetsArtifactPath)\nif err != nil {\n\tif os.IsNotExist(err) { /* regenerate archive and retry once */ }\n\treturn fmt.Errorf(\"failed to hash runtime assets: %w\", err)\n}","preventionTips":["Hash immediately after creating the archive in the same process/directory","Avoid shared temp dirs where other processes can delete artifacts","Monitor disk health on build machines","Retry the build once on transient read errors"],"tags":["go","bundler","hashing","file-read"],"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"}