{"record":{"id":"8ede11720b2865aa","repo":"hasura/graphql-engine","slug":"failed-to-unpack-into-staging-dir-w","errorCode":null,"errorMessage":"failed to unpack into staging dir: %w","messagePattern":"failed to unpack into staging dir: %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/plugins/plugins.go","lineNumber":306,"sourceCode":"\t\terr := os.MkdirAll(downloadStagingDir, 0o755)\n\t\tif err != nil {\n\t\t\treturn errors.E(\n\t\t\t\top,\n\t\t\t\tfmt.Errorf(\"could not create staging dir %q: %w\", downloadStagingDir, err),\n\t\t\t)\n\t\t}\n\t\tdefer func() {\n\t\t\tc.Logger.Debugf(\"Deleting the download staging directory %s\", downloadStagingDir)\n\n\t\t\terr := os.RemoveAll(downloadStagingDir)\n\t\t\tif err != nil {\n\t\t\t\tc.Logger.Debugf(\"failed to clean up download staging directory: %s\", err)\n\t\t\t}\n\t\t}()\n\n\t\terr = downloadAndExtract(downloadStagingDir, platform.URI, platform.Sha256)\n\t\tif err != nil {\n\t\t\treturn errors.E(op, fmt.Errorf(\"failed to unpack into staging dir: %w\", err))\n\t\t}\n\n\t\terr = moveToInstallDir(downloadStagingDir, installDir, platform.Files)\n\t\tif err != nil {\n\t\t\treturn errors.E(\n\t\t\t\top,\n\t\t\t\tfmt.Errorf(\"failed while moving files to the installation directory: %w\", err),\n\t\t\t)\n\t\t}\n\t}\n\n\tsubPathAbs, err := filepath.Abs(installDir)\n\tif err != nil {\n\t\treturn errors.E(\n\t\t\top,\n\t\t\tfmt.Errorf(\"failed to get the absolute fullPath of %q: %w\", installDir, err),\n\t\t)\n\t}","sourceCodeStart":288,"sourceCodeEnd":324,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/cli/plugins/plugins.go#L288-L324","documentation":"installPlugin() calls downloadAndExtract(stagingDir, platform.URI, platform.Sha256) to fetch the platform artifact, verify its sha256, and unpack it into the staging directory. Any failure there — network error, HTTP 404, checksum mismatch, archive format problem, or write error while extracting — surfaces wrapped in this error.","triggerScenarios":"The platform.URI download fails (offline, proxy, DNS), returns 404/403 because the release artifact was moved or deleted, the downloaded artifact's hash does not match platform.Sha256, or the archive is corrupt / not a supported archive format.","commonSituations":"Plugin author re-published a release so the pinned sha256 no longer matches; artifact URL from an old manifest is dead; corporate proxy or firewall blocks the download; truncated download on flaky networks; artifact uploaded in an unpackable format.","solutions":["Verify platform.URI in the plugin manifest resolves to a real artifact (curl -I the URL)","Compare the artifact's actual sha256 with platform.Sha256 in the manifest — if they differ, the manifest pins a stale hash and must be updated or a newer plugin version used","Check network/proxy/DNS if the download itself fails; unset or configure proxy env vars as needed","Clear the staging/download directory and retry to rule out a corrupted partial download"],"exampleFix":"# before: stale checksum in manifest\n\"sha256\": \"oldhash...\"\n# after: recompute against current artifact\n$ curl -sL https://example.com/myplugin-linux-amd64.zip | sha256sum\n\"sha256\": \"newhash...\"","handlingStrategy":"retry","validationCode":"// verify artifact URL and checksum before installing\nresp, err := http.Head(platform.URI)\nif err != nil || resp.StatusCode != http.StatusOK { /* fix URL first */ }\nh, _ := sha256fileOfDownloaded(platform.URI) // compare with platform.Sha256","typeGuard":null,"tryCatchPattern":"err := cfg.Install(plugin)\nif err != nil && strings.Contains(err.Error(), \"failed to unpack into staging dir\") {\n\t// distinguish checksum vs network via the wrapped text;\n\t// network failures: retry with backoff; checksum failures: update the manifest hash\n}","preventionTips":["Pin manifests to immutable release URLs (tagged versions, not latest)","Recompute sha256 whenever you republish an artifact","Add retry with backoff around installs in CI to absorb transient network failures"],"tags":["plugins","download","checksum","network","install"],"backgroundTag":"artifact-checksum-mismatch","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}