{"record":{"id":"7a663ffd84deb3c4","repo":"crowdsecurity/crowdsec","slug":"s-w-7a663f","errorCode":null,"errorMessage":"%s: %w","messagePattern":"%s: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/hubops/download.go","lineNumber":176,"sourceCode":"\t}\n\n\treturn needReload, nil\n}\n\nfunc (c *DownloadCommand) Run(ctx context.Context, plan *ActionPlan) error {\n\ti := c.Item\n\n\tfmt.Fprintf(os.Stdout, \"downloading %s\\n\", colorizeItemName(i.FQName()))\n\n\t// ensure that target file is within target dir\n\tfinalPath, err := i.PathForDownload()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdownloaded, _, err := i.FetchContentTo(ctx, c.contentProvider, finalPath)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"%s: %w\", i.FQName(), err)\n\t}\n\n\tif downloaded {\n\t\tplan.ReloadNeeded = true\n\t}\n\n\ti.State.Tainted = false\n\ti.State.UpToDate = true\n\n\t// read content to get the list of data files\n\treader, err := os.Open(finalPath)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"while opening %s: %w\", finalPath, err)\n\t}\n\n\tdefer reader.Close()\n\n\tneedReload, err := downloadDataSet(ctx, plan.hub.GetDataDir(), c.Force, reader)","sourceCodeStart":158,"sourceCodeEnd":194,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/hubops/download.go#L158-L194","documentation":"Wraps failures from i.FetchContentTo during `cscli hub` download operations. FetchContentTo fetches the item's archive/content from the hub (local or remote) into finalPath; any error is prefixed with the item's fully-qualified name so the user knows which item failed.","triggerScenarios":"Running `cscli hub update`/`install`/`upgrade` (Run of the download operation) when the hub content fetch fails: CAPI unreachable, item not present in the hub index, corrupted local tarmac, or write failure to the destination path.","commonSituations":"No outbound connectivity to the CrowdSec hub/API; stale local hub index after upstream items were removed; disk full or read-only install directory; interrupted prior download left bad state.","solutions":["Check connectivity to the hub and run `cscli hub update` to refresh the index.","Read the wrapped error for the specific cause (DNS, 404, write permission).","For persistent 404s, remove and reinstall the item: `cscli <type> remove <item> --force` then `cscli <type> install <item>`.","Verify the install/data directories are writable by the crowdsec user."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if err := checkHubConnectivity(); err != nil {\n    return fmt.Errorf(\"hub unreachable, aborting: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"downloaded, _, err := item.FetchContentTo(ctx, cp, path)\nif err != nil {\n    return fmt.Errorf(\"hub fetch failed for %s: %w\", item.FQName(), err)\n}","preventionTips":["Run `cscli hub update` regularly so the local index matches upstream.","Ensure outbound connectivity to the CrowdSec hub/CAPI from the host.","Keep the install/data directories writable and with sufficient disk space.","Reinstall items cleanly if a previous download was interrupted."],"tags":["hub","download","capi","wrapped-error"],"backgroundTag":"api-request-failed","analyzedSha":"909b5157986a2b2c2163300fdaef5ed01289f7d2","analyzedAt":"2026-09-06T12:27:26.012Z","contentChangedAt":"2026-09-06T12:27:26.012Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}