crowdsecurity/crowdsec · error
unknown configuration type '%s'
Error message
unknown configuration type '%s'
What it means
After splitting a hub path, the first segment must be one of the known hub item types in cwhub.ItemTypes (parsers, scenarios, postoverflows, collections, etc.). If subs[0] is not a recognized type, the file sits under a directory that is not a valid hub type and the item spec cannot be built. The code comments that this 'doesn't really happen anymore' because only {hubtype} directories are scanned, but it remains a guard.
Source
Thrown at pkg/cwhub/sync.go:46
ftype string // type, plural (collections, contexts etc.)
fauthor string // author - empty for local items
inhub bool // true if the spec comes from the hub dir
target string // the target of path if it's a link, otherwise == path
local bool // is this a spec for a local item?
}
func newHubItemSpec(path string, subs []string) (*itemSpec, error) {
// .../hub/parsers/s00-raw/crowdsecurity/skip-pretag.yaml
// .../hub/scenarios/crowdsecurity/ssh_bf.yaml
// .../hub/profiles/crowdsecurity/linux.yaml
if len(subs) < 3 {
return nil, fmt.Errorf("path is too short: %s (%d)", path, len(subs))
}
ftype := subs[0]
if !slices.Contains(ItemTypes, ftype) {
// this doesn't really happen anymore, because we only scan the {hubtype} directories
return nil, fmt.Errorf("unknown configuration type '%s'", ftype)
}
stage := ""
fauthor := subs[1]
fname := subs[2]
if ftype == PARSERS || ftype == POSTOVERFLOWS {
if len(subs) < 4 {
return nil, fmt.Errorf("path is too short: %s (%d)", path, len(subs))
}
stage = subs[1]
fauthor = subs[2]
fname = subs[3]
}
spec := itemSpec{
path: path,View on GitHub (pinned to 909b515798)
Solutions
- Rename the directory to a valid hub type (parsers, parsers/s00-raw, scenarios, postoverflows, collections, alerts, appsec-configs, appsec-rules, contexts, etc.)
- Move non-hub files out of the hub directory into your configuration directory
- Run 'cscli hub update' so the local hub tree matches the expected upstream layout
Example fix
// before: hub/parser/crowdsecurity/foo.yaml (invalid type dir) mv /etc/crowdsec/hub/parser /tmp/stray // after: no unknown type directories under hub/, local files live in the config dir
Defensive patterns
Strategy: validation
Validate before calling
validTypes := map[string]bool{
"parsers": true, "postoverflows": true, "scenarios": true,
"collections": true, "appsec-configs": true, "appsec-rules": true,
"contexts": true,
}
firstDir := firstSegmentAfter(hubDir, file)
if !validTypes[firstDir] {
return fmt.Errorf("%q is not a hub type dir; move the file", firstDir)
} Try / catch
if err := hub.Load(ctx); err != nil {
if strings.Contains(err.Error(), "unknown configuration type") {
log.Warnf("stray directory under hub dir: %v", err)
return nil
}
return err
} Prevention
- Only create directories in the hub tree with names matching official hub item types
- Check hub type directory names against `cscli hub list` output categories
- Store personal/unclassified files outside the hub directory entirely
When it happens
Trigger: Calling Hub.Load/localSync when the scanned hub directory tree contains a subdirectory whose name is not in ItemTypes, and a file is found beneath it.
Common situations: Creating a custom directory under the hub dir (e.g. hub/myfiles/foo.yaml); typos in a manually created type directory ('parser' instead of 'parsers'); stale directories from an older hub layout that were renamed upstream.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- invalid auth_type: must be one of basic_auth, headers, mtls
- no parser found. Please install the appropriate parser and r
- path is too short: %s (%d)
- file '%s' is not from hub '%s' nor from the configuration di
- %s: %w
AI-assisted analysis of crowdsecurity/crowdsec@909b515798 (2026-09-06).
Data as JSON: /api/errors/ab860eafe21361c5.
Report an issue: GitHub.