{"record":{"id":"891bd83fe6df2477","repo":"multica-ai/multica","slug":"download-failed-w","errorCode":null,"errorMessage":"download failed: %w","messagePattern":"download failed: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/internal/cli/update.go","lineNumber":419,"sourceCode":"\ttimeout := updateDownloadTimeoutOrDefault(downloadTimeout)\n\tmanifestData, err := fetchURLBytes(manifestAsset.BrowserDownloadURL, timeout)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"download checksum manifest: %w\", err)\n\t}\n\texpectedSum, err := parseChecksumManifest(manifestData, assetName)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"parse checksum manifest: %w\", err)\n\t}\n\n\t// Buffer the archive into memory so we can verify the full SHA-256\n\t// before writing anything to disk. Release archives are ~10–30 MB; the\n\t// extraction code already buffers zip archives in full (random access\n\t// requirement), so this is not a new memory cost on Windows. For tar.gz\n\t// it adds a single in-RAM copy, which is preferable to running the\n\t// untrusted bytes through gzip+tar extraction before the SHA-256 check.\n\tarchiveData, err := fetchURLBytes(downloadURL, timeout)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"download failed: %w\", err)\n\t}\n\n\tif err := verifyAssetSHA256(archiveData, expectedSum, assetName); err != nil {\n\t\t// Do NOT extract or replace; the next poll tick will retry. A\n\t\t// corrupted asset is rare enough that retrying through the same\n\t\t// CDN is the right default; persistent failures will surface in\n\t\t// the daemon log.\n\t\treturn \"\", fmt.Errorf(\"verify download: %w\", err)\n\t}\n\n\t// Extract the binary from the archive.\n\tbinaryName := \"multica\"\n\tif runtime.GOOS == \"windows\" {\n\t\tbinaryName = \"multica.exe\"\n\t}\n\tvar binaryData []byte\n\tif runtime.GOOS == \"windows\" {\n\t\tbinaryData, err = extractBinaryFromZip(bytes.NewReader(archiveData), binaryName)","sourceCodeStart":401,"sourceCodeEnd":437,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/internal/cli/update.go#L401-L437","documentation":"The release archive itself is fetched with fetchURLBytes; failure is wrapped as 'download failed: %w'. Underlying causes are transport errors (timeout at DefaultUpdateDownloadTimeout of 120s, connection reset, DNS) or the 'HTTP %d from %s' non-200 error. The archive is buffered in memory (~10–30 MB) before any disk write.","triggerScenarios":"Slow links exceeding the 120s timeout on a ~30 MB archive; the asset 404ing after the metadata was fetched (release edited mid-update); interrupted connections; a caller passing a short custom downloadTimeout to UpdateViaDownloadWithTimeout.","commonSituations":"Metered or congested networks; CI environments with restricted egress that allow the API but block the objects CDN (objects.githubusercontent.com); updates attempted while the release assets were being replaced.","solutions":["If a custom timeout was passed, raise it or pass 0 to get the 120s default via updateDownloadTimeoutOrDefault.","Verify the archive URL from the error's wrapped message downloads in a browser/curl.","Retry — transient CDN resets and half-published releases resolve on the next poll tick.","Check egress rules for objects.githubusercontent.com in firewalled environments."],"exampleFix":"// before\nout, err := cli.UpdateViaDownloadWithTimeout(ver, 5*time.Second) // too short for 30MB\n\n// after\nout, err := cli.UpdateViaDownloadWithTimeout(ver, 0) // uses DefaultUpdateDownloadTimeout (120s)","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"out, err := cli.UpdateViaDownloadWithTimeout(ver, timeout)\nif err != nil {\n    if strings.HasPrefix(err.Error(), \"download failed\") {\n        var ne net.Error\n        if errors.As(err, &ne) && ne.Timeout() {\n            // raise timeout on retry (0 selects the 120s default)\n            out, err = cli.UpdateViaDownloadWithTimeout(ver, 0)\n        }\n    }\n}","preventionTips":["Pass timeout 0 to use the 120s default rather than a short custom value","Allow egress to objects.githubusercontent.com in firewalled environments","Retry on the poller's next tick for transient resets"],"tags":["download","network","timeout","release"],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}