{"record":{"id":"cbd67cb8c6822efc","repo":"crowdsecurity/crowdsec","slug":"unable-to-create-folder-s-w-cbd67c","errorCode":null,"errorMessage":"unable to create folder '%s': %w","messagePattern":"unable to create folder '(.+?)': %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/hubtest/postoverflow.go","lineNumber":67,"sourceCode":"\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 {\n\t\tfound, err := t.installPostoverflowCustomFrom(postoverflow, customPath)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/hubtest/postoverflow.go#L49-L85","documentation":"After validating the stage, installPostoverflowCustomFrom creates the destination stage directory under the test runtime path with os.MkdirAll. Failure to create it (permission denied, path is a file, invalid characters) is wrapped with the target directory path and aborts the custom postoverflow install.","triggerScenarios":"os.MkdirAll(stageDirDest, os.ModePerm) fails because t.RuntimePath/postoverflows/<stage> cannot be created: runtime path points into a read-only tree, a file occupies a path component, or RuntimePath is empty/invalid.","commonSituations":"Test runtime directory on a read-only mount; leftover regular file where a directory is expected; RuntimePath misconfigured in the test definition.","solutions":["Check the wrapped MkdirAll error for the OS cause (EACCES/ENOTDIR)","Verify t.RuntimePath exists, is writable, and contains no file blocking the stage path","Remove the conflicting file at <runtime>/postoverflows/<stage> and re-run","Run the tests with sufficient filesystem permissions"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if err := os.MkdirAll(t.RuntimePath, 0o755); err != nil {\n    return fmt.Errorf(\"runtime path unusable: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"if err := t.installPostoverflowCustom(p); err != nil {\n    var perr *os.PathError\n    if errors.As(err, &perr) {\n        log.Errorf(\"mkdir failed for %s: %v\", perr.Path, perr.Err)\n    }\n    return err\n}","preventionTips":["Provision a writable RuntimePath in CI before tests","Avoid pointing RuntimePath at read-only mounts","Check no regular file occupies the postoverflows/<stage> path"],"tags":["filesystem","mkdir","hubtest"],"backgroundTag":"mkdir-permission-denied","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"}