{"record":{"id":"1db12595256bcbeb","repo":"crowdsecurity/crowdsec","slug":"unable-to-create-folder-s-w-1db125","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/parser.go","lineNumber":67,"sourceCode":"\tcustomParserPath := filepath.Join(customPath, parser)\n\tif _, err := os.Stat(customParserPath); os.IsNotExist(err) {\n\t\treturn false, nil\n\t}\n\n\tcustomParserPathSplit, customParserName := filepath.Split(customParserPath)\n\t// because path is parsers/<stage>/<author>/parser.yaml and we wan't the stage\n\tsplitPath := strings.Split(customParserPathSplit, string(os.PathSeparator))\n\tcustomParserStage := splitPath[len(splitPath)-3]\n\n\t// check if stage exist\n\thubStagePath := filepath.Join(t.HubPath, fmt.Sprintf(\"parsers/%s\", customParserStage))\n\tif _, err := os.Stat(hubStagePath); os.IsNotExist(err) {\n\t\treturn false, fmt.Errorf(\"stage '%s' extracted from '%s' doesn't exist in the hub\", customParserStage, hubStagePath)\n\t}\n\n\tstageDirDest := fmt.Sprintf(\"%s/parsers/%s/\", t.RuntimePath, customParserStage)\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\tcustomParserDest := filepath.Join(stageDirDest, customParserName)\n\t// if path to parser exist, copy it\n\tif err := Copy(customParserPath, customParserDest); err != nil {\n\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","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/hubtest/parser.go#L49-L85","documentation":"After validating the stage, installParserCustomFrom creates the stage directory under the runtime path with os.MkdirAll and wraps any failure. This is a directory-creation failure inside the test runtime tree.","triggerScenarios":"os.MkdirAll(runtimePath+/parsers/<stage>/, ModePerm) failing because a parent component is a file, permission denied, or the path is invalid/too long.","commonSituations":"RuntimePath pointing at a read-only or non-writable location; a file named 'parsers' already existing in the runtime dir; running as unprivileged user against a root-owned runtime dir; overly long stage names on Windows.","solutions":["Check permissions on the runtime path and chown/chmod it so the test user can write.","Remove or rename any regular file that conflicts with the 'parsers' directory component.","Verify RuntimePath in the test configuration points to a writable directory."],"exampleFix":"// before\nrt := \"/var/lib/crowdsec/data\" // read-only\nrunTests(runtimePath: rt)\n// after\nrt := t.TempDir() // or a writable dir\nrunTests(runtimePath: rt)","handlingStrategy":"validation","validationCode":"if fi, err := os.Stat(runtimePath); err != nil || !fi.IsDir() {\n\treturn fmt.Errorf(\"runtime path %s must be an existing writable directory\", runtimePath)\n}\nif err := os.WriteFile(filepath.Join(runtimePath, \".probe\"), nil, 0o644); err != nil {\n\treturn fmt.Errorf(\"runtime path not writable: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"if err := item.InstallParserCustom(name); err != nil {\n\tif errors.Is(err, os.ErrPermission) {\n\t\t// chown/chmod runtime path and retry\n\t}\n\treturn err\n}","preventionTips":["Point RuntimePath at a user-writable directory (e.g. a temp dir in CI).","Remove any file that shadows a required directory component (e.g. a file named 'parsers').","Watch path-length limits on Windows."],"tags":["hubtest","mkdir","permissions","filesystem"],"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-14T00:17:10.932Z"}