{"record":{"id":"0c40d04f20635330","repo":"crowdsecurity/crowdsec","slug":"stage-s-from-extracted-s-doesn-t-exist-in-th","errorCode":null,"errorMessage":"stage '%s' from extracted '%s' doesn't exist in the hub","messagePattern":"stage '(.+?)' from extracted '(.+?)' doesn't exist in the hub","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/hubtest/postoverflow.go","lineNumber":62,"sourceCode":"\treturn nil\n}\n\nfunc (t *HubTestItem) installPostoverflowCustomFrom(postoverflow string, customPath string) (bool, error) {\n\t// we check if its a custom postoverflow\n\tcustomPostOverflowPath := filepath.Join(customPath, postoverflow)\n\tif _, err := os.Stat(customPostOverflowPath); os.IsNotExist(err) {\n\t\treturn false, nil\n\t}\n\n\tcustomPostOverflowPathSplit := strings.Split(customPostOverflowPath, \"/\")\n\tcustomPostoverflowName := customPostOverflowPathSplit[len(customPostOverflowPathSplit)-1]\n\t// because path is postoverflows/<stage>/<author>/parser.yaml and we wan't the stage\n\tcustomPostoverflowStage := customPostOverflowPathSplit[len(customPostOverflowPathSplit)-3]\n\n\t// check if stage exist\n\thubStagePath := filepath.Join(t.HubPath, fmt.Sprintf(\"postoverflows/%s\", customPostoverflowStage))\n\tif _, err := os.Stat(hubStagePath); os.IsNotExist(err) {\n\t\treturn false, fmt.Errorf(\"stage '%s' from extracted '%s' doesn't exist in the hub\", customPostoverflowStage, hubStagePath)\n\t}\n\n\tstageDirDest := fmt.Sprintf(\"%s/postoverflows/%s/\", t.RuntimePath, customPostoverflowStage)\n\tif err := os.MkdirAll(stageDirDest, os.ModePerm); err != nil {\n\t\treturn false, fmt.Errorf(\"unable to create folder '%s': %w\", stageDirDest, err)\n\t}\n\n\tcustomPostoverflowDest := filepath.Join(stageDirDest, customPostoverflowName)\n\t// if path to postoverflow exist, copy it\n\tif err := Copy(customPostOverflowPath, customPostoverflowDest); err != nil {\n\t\treturn false, fmt.Errorf(\"unable to copy custom parser '%s' to '%s': %w\", customPostOverflowPath, customPostoverflowDest, err)\n\t}\n\n\treturn true, nil\n}\n\nfunc (t *HubTestItem) installPostoverflowCustom(postoverflow string) error {\n\tfor _, customPath := range t.CustomItemsLocation {","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/hubtest/postoverflow.go#L44-L80","documentation":"installPostoverflowCustomFrom installs a custom (non-hub) postoverflow extracted from an archive. The stage is derived from the archive path (postoverflows/<stage>/<author>/file.yaml). Before copying, it verifies the stage directory exists in the reference hub; if not, it refuses with this error, since the stage is not recognized.","triggerScenarios":"installPostoverflowCustom called with a postoverflow archive whose extracted path has a stage component (third from the end of the path) that does not exist under HubPath/postoverflows/ — e.g. typo'd stage, wrong archive layout, or hub not downloaded.","commonSituations":"Testing a third-party postoverflow with a nonstandard directory structure; hub not updated so the stage folder is absent; archives built for a different hub layout version.","solutions":["Verify the archive extracts to postoverflows/<stage>/<author>/file.yaml with a stage that exists in the hub","Run `cscli hub update` to make sure all hub stages are present locally","Fix the stage directory name in the archive to match an existing hub stage (e.g. s00-enrich)","Check that t.HubPath points at the real hub root"],"exampleFix":"// before (archive layout)\npostoverflows/s00-unknown/author/parse.yaml\n// after\npostoverflows/s00-enrich/author/parse.yaml","handlingStrategy":"validation","validationCode":"stage := pathParts[len(pathParts)-3]\nif fi, err := os.Stat(filepath.Join(hubPath, \"postoverflows\", stage)); err != nil || !fi.IsDir() {\n    return fmt.Errorf(\"unknown stage %q in archive\", stage)\n}","typeGuard":null,"tryCatchPattern":"installed, err := t.installPostoverflowCustom(archivePath)\nif err != nil {\n    if strings.Contains(err.Error(), \"doesn't exist in the hub\") {\n        return fmt.Errorf(\"re-pack archive with a valid hub stage: %w\", err)\n    }\n    return err\n}","preventionTips":["Package archives as postoverflows/<stage>/<author>/file.yaml with real hub stages","Run `cscli hub update` before hub tests so all stages exist locally","Validate archive layout before testing third-party postoverflows"],"tags":["hubtest","path","stage"],"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-14T05:17:10.506Z"}