{"record":{"id":"85c290450283f4c9","repo":"github/copilot-sdk","slug":"linuxmuslruntimelibhash-must-be-a-sha-256-hash-d","errorCode":null,"errorMessage":"LinuxMuslRuntimeLibHash must be a SHA-256 hash (%d bytes), got %d bytes","messagePattern":"LinuxMuslRuntimeLibHash must be a SHA-256 hash \\((.+?) bytes\\), got (.+?) bytes","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/internal/embeddedcli/embeddedcli.go","lineNumber":76,"sourceCode":"\tLinuxMuslRuntimeAssets         io.Reader\n\tLinuxMuslRuntimeAssetsHash     []byte\n\n\tDir     string\n\tVersion string\n}\n\nfunc Setup(cfg Config) {\n\tif cfg.Cli == nil {\n\t\tpanic(\"Cli reader is required\")\n\t}\n\tif len(cfg.CliHash) != sha256.Size {\n\t\tpanic(fmt.Sprintf(\"CliHash must be a SHA-256 hash (%d bytes), got %d bytes\", sha256.Size, len(cfg.CliHash)))\n\t}\n\tif cfg.LinuxMuslCli != nil && len(cfg.LinuxMuslCliHash) != sha256.Size {\n\t\tpanic(fmt.Sprintf(\"LinuxMuslCliHash must be a SHA-256 hash (%d bytes), got %d bytes\", sha256.Size, len(cfg.LinuxMuslCliHash)))\n\t}\n\tif cfg.LinuxMuslRuntimeLib != nil && len(cfg.LinuxMuslRuntimeLibHash) != sha256.Size {\n\t\tpanic(fmt.Sprintf(\"LinuxMuslRuntimeLibHash must be a SHA-256 hash (%d bytes), got %d bytes\", sha256.Size, len(cfg.LinuxMuslRuntimeLibHash)))\n\t}\n\tvalidateRuntimePairConfig(cfg.RuntimeExecutable, cfg.RuntimeExecutableHash, cfg.RuntimeNode, cfg.RuntimeNodeHash, \"\")\n\tvalidateRuntimePairConfig(cfg.LinuxMuslRuntimeExecutable, cfg.LinuxMuslRuntimeExecutableHash, cfg.LinuxMuslRuntimeNode, cfg.LinuxMuslRuntimeNodeHash, \"LinuxMusl\")\n\tvalidateOptionalHash(cfg.RuntimeAssets, cfg.RuntimeAssetsHash, \"RuntimeAssetsHash\")\n\tvalidateOptionalHash(cfg.LinuxMuslRuntimeAssets, cfg.LinuxMuslRuntimeAssetsHash, \"LinuxMuslRuntimeAssetsHash\")\n\tsetupMu.Lock()\n\tdefer setupMu.Unlock()\n\tif setupDone {\n\t\tpanic(\"Setup must only be called once\")\n\t}\n\tif pathInitialized {\n\t\tpanic(\"Setup must be called before Path is accessed\")\n\t}\n\tconfig = cfg\n\tsetupDone = true\n}\n\nvar Path = sync.OnceValue(func() string {","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/github/copilot-sdk/blob/cd8cf15dc3f9e762615790aaed0a771a0f392755/go/internal/embeddedcli/embeddedcli.go#L58-L94","documentation":"If Config.LinuxMuslRuntimeLib is supplied, Setup validates that LinuxMuslRuntimeLibHash is exactly sha256.Size (32) bytes and panics otherwise. The runtime library, like other optional assets, must carry a correct-length SHA-256 checksum for integrity verification during install.","triggerScenarios":"Calling Setup with a non-nil LinuxMuslRuntimeLib while LinuxMuslRuntimeLibHash is nil, empty, hex-encoded-as-bytes, or a digest of the wrong length/algorithm.","commonSituations":"Wiring a new musl runtime library into the embed config without generating its hash, copying a hash from a different asset, or passing hex text instead of decoded raw bytes.","solutions":["Assign the raw 32-byte sha256.Sum256 output of the runtime library to LinuxMuslRuntimeLibHash","Hex-decode the digest with hex.DecodeString if you only have the hex form","Ensure the hash corresponds to the same bytes passed as LinuxMuslRuntimeLib","Add a length assertion before calling Setup"],"exampleFix":"// before\nSetup(Config{LinuxMuslRuntimeLib: libReader, LinuxMuslRuntimeLibHash: []byte(hexSum)})\n// after\nraw, _ := hex.DecodeString(hexSum)\nSetup(Config{LinuxMuslRuntimeLib: libReader, LinuxMuslRuntimeLibHash: raw})","handlingStrategy":"validation","validationCode":"if linuxMuslRuntimeLib != nil && len(linuxMuslRuntimeLibHash) != sha256.Size {\n\treturn errors.New(\"LinuxMuslRuntimeLibHash must be raw 32-byte SHA-256\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use sha256.Sum256 on the exact embedded library bytes","Decode hex digests before assignment","Review Config literals for all LinuxMusl* hash fields when adding assets","Validate the whole Config with a helper before Setup"],"tags":["go","sha256","config","linux-musl"],"backgroundTag":"invalid-argument-value","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"}