{"record":{"id":"502e8dad19e59ac7","repo":"crowdsecurity/crowdsec","slug":"unable-to-copy-s-to-s-w-502e8d","errorCode":null,"errorMessage":"unable to copy '%s' to '%s': %w","messagePattern":"unable to copy '(.+?)' to '(.+?)': %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/hubtest/postoverflow.go","lineNumber":33,"sourceCode":"\t\treturn fmt.Errorf(\"can't get absolute path of '%s': %w\", sourcePath, err)\n\t}\n\n\tsourceFilename := filepath.Base(sourcePath)\n\n\t// runtime/hub/postoverflows/s00-enrich/crowdsecurity/\n\thubDirPostoverflowDest := filepath.Join(t.RuntimeHubPath, filepath.Dir(item.RemotePath))\n\n\t// runtime/postoverflows/s00-enrich\n\titemTypeDirDest := fmt.Sprintf(\"%s/postoverflows/%s/\", t.RuntimePath, item.Stage)\n\n\tif err := createDirs([]string{hubDirPostoverflowDest, itemTypeDirDest}); err != nil {\n\t\treturn err\n\t}\n\n\t// runtime/hub/postoverflows/s00-enrich/crowdsecurity/rdns.yaml\n\thubDirPostoverflowPath := filepath.Join(hubDirPostoverflowDest, sourceFilename)\n\tif err := Copy(sourcePath, hubDirPostoverflowPath); err != nil {\n\t\treturn fmt.Errorf(\"unable to copy '%s' to '%s': %w\", sourcePath, hubDirPostoverflowPath, err)\n\t}\n\n\t// runtime/postoverflows/s00-enrich/rdns.yaml\n\tpostoverflowDirParserPath := filepath.Join(itemTypeDirDest, sourceFilename)\n\tif err := os.Symlink(hubDirPostoverflowPath, postoverflowDirParserPath); err != nil {\n\t\tif !os.IsExist(err) {\n\t\t\treturn fmt.Errorf(\"unable to symlink postoverflow '%s' to '%s': %w\", hubDirPostoverflowPath, postoverflowDirParserPath, err)\n\t\t}\n\t}\n\n\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","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/hubtest/postoverflow.go#L15-L51","documentation":"After computing the destination inside the runtime hub, installPostoverflowItem copies the item file with Copy(). If the copy fails (source unreadable, destination not writable, missing directories), the error is wrapped naming both source and destination paths. This blocks the postoverflow from being installed for the hub test.","triggerScenarios":"Copy(sourcePath, hubDirPostoverflowPath) fails: source file missing, target directory absent (hub dir creation failed earlier), or permission issues.","commonSituations":"Runtime hub directory not created due to earlier mkdir failure; read-only test runtime tree; hub item deleted between enumeration and install; disk full.","solutions":["Check the wrapped Copy error for the exact OS-level cause (ENOENT/EACCES)","Ensure the runtime hub postoverflow directory exists and is writable","Verify the source item file exists at t.HubPath/<RemotePath>","Re-run `cscli hub update` if hub files are missing/corrupt"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"src := filepath.Join(t.HubPath, item.RemotePath)\nif _, err := os.Stat(src); err != nil {\n    return fmt.Errorf(\"source missing: %w\", err)\n}\nif err := os.MkdirAll(filepath.Dir(dst), 0o755); err != nil {\n    return fmt.Errorf(\"dest dir: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"if err := t.installPostoverflow(item); err != nil {\n    var perr *os.PathError\n    if errors.As(errors.Unwrap(err), &perr) {\n        log.Errorf(\"fs failure on %s: %v\", perr.Path, perr.Err)\n    }\n    return err\n}","preventionTips":["Ensure the runtime hub directories are created before install","Keep the test runtime tree writable by the test user","Don't mutate the hub tree while tests run"],"tags":["filesystem","copy","hubtest"],"backgroundTag":"file-write-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"}