crowdsecurity/crowdsec · error

while pulling blocklist: %w

Error message

while pulling blocklist: %w

What it means

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).

Source

Thrown at pkg/apiserver/apic.go:696

	if hasPulledAllowlists {
		deleted, err := a.dbClient.ApplyAllowlistsToExistingDecisions(ctx)
		if err != nil {
			log.Errorf("could not apply allowlists to existing decisions: %s", err)
		}

		if deleted > 0 {
			log.Infof("deleted %d decisions from allowlists", deleted)
		}
	}

	return nil
}

// we receive a link to a blocklist, we pull the content of the blocklist and we create one alert
func (a *apic) PullBlocklist(ctx context.Context, blocklist *modelscapi.BlocklistLink, forcePull bool) error {
	addCounters, _ := makeAddAndDeleteCounters()
	if err := a.UpdateBlocklists(ctx, []*modelscapi.BlocklistLink{blocklist}, addCounters, forcePull); err != nil {
		return fmt.Errorf("while pulling blocklist: %w", err)
	}

	return nil
}

func (a *apic) PullAllowlist(ctx context.Context, allowlist *modelscapi.AllowlistLink, forcePull bool) error {
	if err := a.UpdateAllowlists(ctx, []*modelscapi.AllowlistLink{allowlist}, forcePull); err != nil {
		return fmt.Errorf("while pulling allowlist: %w", err)
	}

	return nil
}

func (a *apic) updateOneAllowlist(ctx context.Context, client *apiclient.ApiClient, link *modelscapi.AllowlistLink) error {
	if log.IsLevelEnabled(log.TraceLevel) {
		log.Tracef("allowlist body: %+v", spew.Sdump(link))
	}

View on GitHub (pinned to 909b515798)

Solutions

  1. Check the wrapped error: download issues point to the blocklist URL, parse issues to a malformed blocklist file
  2. Verify the blocklist URL still serves the expected format
  3. Check DB health if the failure occurred at decision insertion
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at pkg/apiserver/apic.go:696 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of crowdsecurity/crowdsec@909b515798 (2026-09-06). Data as JSON: /api/errors/d28bee2afe83e429. Report an issue: GitHub.