crowdsecurity/crowdsec · error

couldn't find custom postoverflow '%s' in the following loca

Error message

couldn't find custom postoverflow '%s' in the following location: %+v

What it means

installPostoverflowCustom in pkg/hubtest installs a custom (locally-authored, not from the hub) postoverflow for a hub test. It iterates over t.CustomItemsLocation directories looking for a file whose name matches the requested postoverflow; if none of those directories contain a matching item, it returns this error. It means the test referenced a custom postoverflow that does not exist under any of the configured custom item locations.

Source

Thrown at pkg/hubtest/postoverflow.go:91

		return false, fmt.Errorf("unable to copy custom parser '%s' to '%s': %w", customPostOverflowPath, customPostoverflowDest, err)
	}

	return true, nil
}

func (t *HubTestItem) installPostoverflowCustom(postoverflow string) error {
	for _, customPath := range t.CustomItemsLocation {
		found, err := t.installPostoverflowCustomFrom(postoverflow, customPath)
		if err != nil {
			return err
		}

		if found {
			return nil
		}
	}

	return fmt.Errorf("couldn't find custom postoverflow '%s' in the following location: %+v", postoverflow, t.CustomItemsLocation)
}

func (t *HubTestItem) installPostoverflow(name string) error {
	if hubPostOverflow := t.HubIndex.GetItem(cwhub.POSTOVERFLOWS, name); hubPostOverflow != nil {
		return t.installPostoverflowItem(hubPostOverflow)
	}

	return t.installPostoverflowCustom(name)
}

View on GitHub (pinned to 909b515798)

Solutions

  1. Verify the postoverflow file name matches exactly (including extension) the name passed to the test.
  2. Add the directory containing the custom postoverflow to the test's CustomItemsLocation.
  3. If the postoverflow comes from the hub instead, ensure 'cscli hub update'/'cscli postoverflows install' has been run so it appears in the hub index.
  4. Run the test from the repository root / correct cwd so relative custom locations resolve.

Example fix

// before
installPostoverflowCustom(t, "my-pos") // file is at ./custom/my-postoverflow.yaml
// after
// rename the file to ./custom/my-pos.yaml or pass "my-postoverflow"
installPostoverflowCustom(t, "my-postoverflow")
Defensive patterns

Strategy: validation

Validate before calling

for _, loc := range item.CustomItemsLocation {
	if _, err := os.Stat(filepath.Join(loc, postoverflow+".yaml")); err == nil {
		// safe to call installPostoverflow
	}
}

Try / catch

if err := t.installPostoverflow(name); err != nil {
	if strings.Contains(err.Error(), "couldn't find custom postoverflow") {
		log.Warnf("custom postoverflow %q missing, skipping: %v", name, err)
		return nil
	}
	return err
}

Prevention

When it happens

Trigger: Calling installPostoverflow (via HubTestItem test loading) with a postoverflow name that is not found in the hub index and not found in any directory listed in t.CustomItemsLocation.

Common situations: Typo in the postoverflow name in the test's .tests config; the custom postoverflow yaml lives in a directory not added to CustomItemsLocation; the file was renamed or deleted; tests run from a different working directory so relative custom paths don't resolve.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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