{"record":{"id":"ab860eafe21361c5","repo":"crowdsecurity/crowdsec","slug":"unknown-configuration-type-s","errorCode":null,"errorMessage":"unknown configuration type '%s'","messagePattern":"unknown configuration type '(.+?)'","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/cwhub/sync.go","lineNumber":46,"sourceCode":"\tftype   string // type, plural (collections, contexts etc.)\n\tfauthor string // author - empty for local items\n\tinhub   bool   // true if the spec comes from the hub dir\n\ttarget  string // the target of path if it's a link, otherwise == path\n\tlocal   bool   // is this a spec for a local item?\n}\n\nfunc newHubItemSpec(path string, subs []string) (*itemSpec, error) {\n\t// .../hub/parsers/s00-raw/crowdsecurity/skip-pretag.yaml\n\t// .../hub/scenarios/crowdsecurity/ssh_bf.yaml\n\t// .../hub/profiles/crowdsecurity/linux.yaml\n\tif len(subs) < 3 {\n\t\treturn nil, fmt.Errorf(\"path is too short: %s (%d)\", path, len(subs))\n\t}\n\n\tftype := subs[0]\n\tif !slices.Contains(ItemTypes, ftype) {\n\t\t// this doesn't really happen anymore, because we only scan the {hubtype} directories\n\t\treturn nil, fmt.Errorf(\"unknown configuration type '%s'\", ftype)\n\t}\n\n\tstage := \"\"\n\tfauthor := subs[1]\n\tfname := subs[2]\n\n\tif ftype == PARSERS || ftype == POSTOVERFLOWS {\n\t\tif len(subs) < 4 {\n\t\t\treturn nil, fmt.Errorf(\"path is too short: %s (%d)\", path, len(subs))\n\t\t}\n\n\t\tstage = subs[1]\n\t\tfauthor = subs[2]\n\t\tfname = subs[3]\n\t}\n\n\tspec := itemSpec{\n\t\tpath:    path,","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/cwhub/sync.go#L28-L64","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before: hub/parser/crowdsecurity/foo.yaml (invalid type dir)\nmv /etc/crowdsec/hub/parser /tmp/stray\n// after: no unknown type directories under hub/, local files live in the config dir","handlingStrategy":"validation","validationCode":"validTypes := map[string]bool{\n\t\"parsers\": true, \"postoverflows\": true, \"scenarios\": true,\n\t\"collections\": true, \"appsec-configs\": true, \"appsec-rules\": true,\n\t\"contexts\": true,\n}\nfirstDir := firstSegmentAfter(hubDir, file)\nif !validTypes[firstDir] {\n\treturn fmt.Errorf(\"%q is not a hub type dir; move the file\", firstDir)\n}","typeGuard":null,"tryCatchPattern":"if err := hub.Load(ctx); err != nil {\n\tif strings.Contains(err.Error(), \"unknown configuration type\") {\n\t\tlog.Warnf(\"stray directory under hub dir: %v\", err)\n\t\treturn nil\n\t}\n\treturn err\n}","preventionTips":["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"],"tags":["hub","item-type","enum","crowdsec"],"backgroundTag":"invalid-enum-value","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"}