{"record":{"id":"7f19db8f093a3f0f","repo":"crowdsecurity/crowdsec","slug":"couldn-t-find-custom-scenario-s-in-the-followin","errorCode":null,"errorMessage":"couldn't find custom scenario '%s' in the following location: %+v","messagePattern":"couldn't find custom scenario '(.+?)' in the following location: %\\+v","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/hubtest/scenario.go","lineNumber":80,"sourceCode":"\t\treturn false, fmt.Errorf(\"unable to copy scenario from '%s' to '%s': %w\", customScenarioPath, scenarioFileDest, err)\n\t}\n\n\treturn true, nil\n}\n\nfunc (t *HubTestItem) installScenarioCustom(scenario string) error {\n\tfor _, customPath := range t.CustomItemsLocation {\n\t\tfound, err := t.installScenarioCustomFrom(scenario, 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 scenario '%s' in the following location: %+v\", scenario, t.CustomItemsLocation)\n}\n\nfunc (t *HubTestItem) installScenario(name string) error {\n\tif item := t.HubIndex.GetItem(cwhub.SCENARIOS, name); item != nil {\n\t\treturn t.installScenarioItem(item)\n\t}\n\n\treturn t.installScenarioCustom(name)\n}\n","sourceCodeStart":62,"sourceCodeEnd":90,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/hubtest/scenario.go#L62-L90","documentation":"installScenarioCustom looks for a custom scenario by name in each directory of t.CustomItemsLocation; if none contains it, this error is returned. The test referenced a custom scenario that isn't present in any of the configured custom locations and isn't in the hub index either.","triggerScenarios":"installScenario is called with a name not found in the hub index, so installScenarioCustom is invoked, and no file matching the name exists in any CustomItemsLocation directory.","commonSituations":"Typo in the scenario name in test config; custom scenario stored outside the directories registered in CustomItemsLocation; scenario file renamed/deleted; running tests before cloning/copying the custom scenario into place.","solutions":["Check the exact file name (with .yaml extension) against the requested scenario name.","Place the custom scenario in one of the directories listed in the error's location output.","Add the scenario's directory to CustomItemsLocation.","If it's a hub scenario instead, install it via cscli so it resolves through the hub index."],"exampleFix":"// before\nCustomItemsLocation: [\"./custom-parsers\"] // scenario is in ./custom-scenarios\n// after\nCustomItemsLocation: [\"./custom-parsers\", \"./custom-scenarios\"]","handlingStrategy":"validation","validationCode":"found := false\nfor _, loc := range item.CustomItemsLocation {\n\tif _, err := os.Stat(filepath.Join(loc, scenario+\".yaml\")); err == nil {\n\t\tfound = true\n\t\tbreak\n\t}\n}\nif !found {\n\t// fail fast with a clear message before calling installScenario\n}","typeGuard":null,"tryCatchPattern":"if err := t.installScenario(name); err != nil {\n\tif strings.Contains(err.Error(), \"couldn't find custom scenario\") {\n\t\treturn fmt.Errorf(\"scenario %q not in hub or custom locations %v\", name, t.CustomItemsLocation)\n\t}\n\treturn err\n}","preventionTips":["Match test-config scenario names exactly to file names.","Register every custom scenario directory in CustomItemsLocation.","Install hub scenarios with cscli before running tests that reference them."],"tags":["crowdsec","hub","scenario","testing"],"backgroundTag":"resource-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"}