{"record":{"id":"d28bee2afe83e429","repo":"crowdsecurity/crowdsec","slug":"while-pulling-blocklist-w","errorCode":null,"errorMessage":"while pulling blocklist: %w","messagePattern":"while pulling blocklist: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/apiserver/apic.go","lineNumber":696,"sourceCode":"\tif hasPulledAllowlists {\n\t\tdeleted, err := a.dbClient.ApplyAllowlistsToExistingDecisions(ctx)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"could not apply allowlists to existing decisions: %s\", err)\n\t\t}\n\n\t\tif deleted > 0 {\n\t\t\tlog.Infof(\"deleted %d decisions from allowlists\", deleted)\n\t\t}\n\t}\n\n\treturn nil\n}\n\n// we receive a link to a blocklist, we pull the content of the blocklist and we create one alert\nfunc (a *apic) PullBlocklist(ctx context.Context, blocklist *modelscapi.BlocklistLink, forcePull bool) error {\n\taddCounters, _ := makeAddAndDeleteCounters()\n\tif err := a.UpdateBlocklists(ctx, []*modelscapi.BlocklistLink{blocklist}, addCounters, forcePull); err != nil {\n\t\treturn fmt.Errorf(\"while pulling blocklist: %w\", err)\n\t}\n\n\treturn nil\n}\n\nfunc (a *apic) PullAllowlist(ctx context.Context, allowlist *modelscapi.AllowlistLink, forcePull bool) error {\n\tif err := a.UpdateAllowlists(ctx, []*modelscapi.AllowlistLink{allowlist}, forcePull); err != nil {\n\t\treturn fmt.Errorf(\"while pulling allowlist: %w\", err)\n\t}\n\n\treturn nil\n}\n\nfunc (a *apic) updateOneAllowlist(ctx context.Context, client *apiclient.ApiClient, link *modelscapi.AllowlistLink) error {\n\tif log.IsLevelEnabled(log.TraceLevel) {\n\t\tlog.Tracef(\"allowlist body: %+v\", spew.Sdump(link))\n\t}\n","sourceCodeStart":678,"sourceCodeEnd":714,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/apiserver/apic.go#L678-L714","documentation":"PullBlocklist failed while updating a single blocklist link (UpdateBlocklists wraps download, parsing and alert/decision insertion). The wrapper only identifies the failing stage; the inner error carries the actual cause (download failure, parse failure, or DB write failure).","triggerScenarios":"Thrown at pkg/apiserver/apic.go:696 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the wrapped error: download issues point to the blocklist URL, parse issues to a malformed blocklist file","Verify the blocklist URL still serves the expected format","Check DB health if the failure occurred at decision insertion"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"909b5157986a2b2c2163300fdaef5ed01289f7d2","analyzedAt":"2026-09-06T12:27:26.012Z","contentChangedAt":"2026-09-06T12:27:26.012Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}