{"record":{"id":"a4c5b5c2db756b60","repo":"crowdsecurity/crowdsec","slug":"couldn-t-find-custom-parser-s-in-the-following","errorCode":null,"errorMessage":"couldn't find custom parser '%s' in the following locations: %+v","messagePattern":"couldn't find custom parser '(.+?)' in the following locations: %\\+v","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/hubtest/parser.go","lineNumber":91,"sourceCode":"\t\treturn false, fmt.Errorf(\"unable to copy custom parser '%s' to '%s': %w\", customParserPath, customParserDest, err)\n\t}\n\n\treturn true, nil\n}\n\nfunc (t *HubTestItem) installParserCustom(parser string) error {\n\tfor _, customPath := range t.CustomItemsLocation {\n\t\tfound, err := t.installParserCustomFrom(parser, customPath)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif found {\n\t\t\treturn nil\n\t\t}\n\t}\n\n\treturn fmt.Errorf(\"couldn't find custom parser '%s' in the following locations: %+v\", parser, t.CustomItemsLocation)\n}\n\nfunc (t *HubTestItem) installParser(name string) error {\n\tif item := t.HubIndex.GetItem(cwhub.PARSERS, name); item != nil {\n\t\treturn t.installParserItem(item)\n\t}\n\n\treturn t.installParserCustom(name)\n}\n","sourceCodeStart":73,"sourceCodeEnd":101,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/hubtest/parser.go#L73-L101","documentation":"installParserCustom searches each directory in HubTestItem.CustomItemsLocation for a file named after the requested parser; if none is found anywhere, it reports all searched locations. It means the custom parser is not registered where hubtest looks — an explicit configuration/layout issue, since the name was also not in the hub index (otherwise installParserItem would have run).","triggerScenarios":"Calling installParser with a name that is neither in the hub index nor present as <name>(.yaml) in any directory listed in CustomItemsLocation.","commonSituations":"Forgot to set --custom-items-location / CustomItemsLocation; parser filename doesn't match the requested name (my-parser vs my_parser); parser exists in hub but under a different item type; typo in the parser name.","solutions":["Set CustomItemsLocation (cscli hubtest run --custom-items-location <dir>) to the directory containing the parser file.","Verify the file name matches the parser name exactly (including .yaml extension handling): `ls <custom-dir>/<name>*`.","If it's a hub parser, confirm it exists: `cscli parsers list | grep <name>`, and update the hub if missing."],"exampleFix":"// before\nitem.CustomItemsLocation = []string{} // unset\nitem.InstallParser(\"my-custom-parser\")\n// after\nitem.CustomItemsLocation = []string{\"./.tests/custom/parsers\"}\nitem.InstallParser(\"my-custom-parser\")","handlingStrategy":"validation","validationCode":"var found string\nfor _, dir := range item.CustomItemsLocation {\n\tif _, err := os.Stat(filepath.Join(dir, parser)); err == nil {\n\t\tfound = filepath.Join(dir, parser)\n\t\tbreak\n\t}\n}\nif found == \"\" {\n\treturn fmt.Errorf(\"custom parser %s not found in %v\", parser, item.CustomItemsLocation)\n}","typeGuard":null,"tryCatchPattern":"if err := item.InstallParser(name); err != nil {\n\tif strings.Contains(err.Error(), \"couldn't find custom parser\") {\n\t\t// fix CustomItemsLocation or the parser name\n\t}\n\treturn err\n}","preventionTips":["Always set CustomItemsLocation when testing non-hub parsers.","Match file names exactly to parser names.","Confirm hub parsers exist with `cscli parsers list` before assuming custom.","Use `cscli hub update` when a hub item is reported missing."],"tags":["hubtest","custom-parser","resource-not-found","configuration"],"backgroundTag":"file-not-found","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"}