{"record":{"id":"8a4e6d498c20e1c4","repo":"crowdsecurity/crowdsec","slug":"unable-to-copy-custom-parser-s-to-s-w-8a4e6d","errorCode":null,"errorMessage":"unable to copy custom parser '%s' to '%s': %w","messagePattern":"unable to copy custom parser '(.+?)' to '(.+?)': %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/hubtest/postoverflow.go","lineNumber":73,"sourceCode":"\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\n\t\tif found {\n\t\t\treturn nil\n\t\t}\n\t}\n\n\treturn fmt.Errorf(\"couldn't find custom postoverflow '%s' in the following location: %+v\", postoverflow, t.CustomItemsLocation)","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/hubtest/postoverflow.go#L55-L91","documentation":"Finally, installPostoverflowCustomFrom copies the extracted custom postoverflow file into the stage directory of the runtime via Copy(). Failure (source unreadable, destination not writable) is wrapped with both source and destination paths. Note the message says 'custom parser' even though this is a postoverflow — a historical naming artifact.","triggerScenarios":"Copy(customPostOverflowPath, customPostoverflowDest) fails: extracted source file unreadable or missing, stage directory not writable (or not created due to earlier failure), or destination path is a directory.","commonSituations":"Archive extraction left the file without read permissions; earlier MkdirAll failure cascaded into a copy failure; antivirus/file lock interfering on Windows; disk full in CI.","solutions":["Read the wrapped Copy error for the exact OS cause and fix permissions/paths","Confirm the extracted source file exists at customPostOverflowPath and is readable","Ensure the stage directory was created (check that error 1178 did not occur earlier)","Re-extract the archive cleanly and retry the hub test"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if _, err := os.Stat(srcPath); err != nil {\n    return fmt.Errorf(\"extracted postoverflow missing: %w\", err)\n}\nif f, err := os.OpenFile(srcPath, os.O_RDONLY, 0); err != nil {\n    return fmt.Errorf(\"source unreadable: %w\", err)\n} else { f.Close() }","typeGuard":null,"tryCatchPattern":"if err := t.installPostoverflowCustom(p); err != nil {\n    if strings.Contains(err.Error(), \"unable to copy\") {\n        log.Errorf(\"copy failed, check perms/space: %v\", err)\n    }\n    return err\n}","preventionTips":["Re-extract archives with sane permissions (0644 files)","Watch free disk space in CI runners","Fix earlier mkdir/copy failures — they cascade into this error","On Windows, exclude test trees from antivirus file locking"],"tags":["filesystem","copy","hubtest"],"backgroundTag":"file-copy-failed","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"}