{"record":{"id":"1c5e726b67e3d227","repo":"spacedriveapp/spacedrive","slug":"operation-aborted-by-user","errorCode":null,"errorMessage":"Operation aborted by user","messagePattern":"Operation aborted by user","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"info","filePath":"apps/cli/src/domains/file/mod.rs","lineNumber":159,"sourceCode":"\t\t\t};\n\n\t\t\tlet choice_index = prompt_for_choice(request)?;\n\n\t\t\t// Apply the user's choice to the input\n\t\t\tmatch choice_index {\n\t\t\t\t0 => {\n\t\t\t\t\t// Overwrite: set conflict resolution in input\n\t\t\t\t\tuse sd_core::ops::files::copy::action::FileConflictResolution;\n\t\t\t\t\tinput.on_conflict = Some(FileConflictResolution::Overwrite);\n\t\t\t\t}\n\t\t\t\t1 => {\n\t\t\t\t\t// Auto-rename: set conflict resolution in input\n\t\t\t\t\tuse sd_core::ops::files::copy::action::FileConflictResolution;\n\t\t\t\t\tinput.on_conflict = Some(FileConflictResolution::AutoModifyName);\n\t\t\t\t}\n\t\t\t\t2 => {\n\t\t\t\t\t// Abort\n\t\t\t\t\tanyhow::bail!(\"Operation aborted by user\");\n\t\t\t\t}\n\t\t\t\t_ => {\n\t\t\t\t\tanyhow::bail!(\"Invalid choice selected\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Execute the action using the input\n\tlet job_id: JobId = execute_action!(ctx, input);\n\tOk(job_id)\n}\n\n/// Simple conflict detection for CLI\nasync fn check_for_simple_conflicts(\n\taction: &sd_core::ops::files::copy::action::FileCopyAction,\n) -> Result<bool> {\n\tuse sd_core::domain::addressing::SdPath;","sourceCodeStart":141,"sourceCodeEnd":177,"githubUrl":"https://github.com/spacedriveapp/spacedrive/blob/6dfeccf2113039e35f2ce735f945e70dc3e4ea45/apps/cli/src/domains/file/mod.rs#L141-L177","documentation":"During an interactive copy with conflicts, the CLI prompt offers the resolutions registered for FileConflictResolution (index 2 is Abort). Choosing Abort bails with 'Operation aborted by user'. This is expected control flow: no files were copied and the action was never dispatched, so the message is a clean cancellation, not a failure.","triggerScenarios":"Running `sd-cli file copy src dst` where dst already contains a matching name, answering the interactive prompt with the Abort option (choice 3 / index 2).","commonSituations":"Users pausing at the conflict prompt and deciding not to proceed; scripts run interactively where someone aborts to inspect first.","solutions":["Nothing to repair; rerun the copy and pick Overwrite or Auto-rename to proceed.","To skip the prompt entirely, request overwrite up front (set the input's overwrite flag, e.g. the CLI's --overwrite option if exposed) so conflicts never trigger confirmation.","In wrappers, treat this specific error as exit code 'cancelled' rather than failure."],"exampleFix":"# before: interactive prompt answered with Abort\nsd-cli file copy /data/a.txt /backup/  # prompt -> 3) Abort -> Operation aborted by user\n\n# after: decide up front, no prompt\nsd-cli file copy --overwrite /data/a.txt /backup/","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"match run_copy_with_confirmation(ctx, input).await {\n    Err(e) if e.to_string() == \"Operation aborted by user\" => {\n        // clean cancellation: nothing was copied, exit quietly with a distinct code\n        std::process::exit(130);\n    }\n    other => other?,\n}","preventionTips":["Pass --overwrite (or set input.overwrite) when the intended behavior is non-interactive replacement.","In wrappers, branch on this exact message and map it to a 'cancelled' exit status instead of 'error'.","Don't retry on this error; the user explicitly declined."],"tags":["cli","file-copy","conflict","user-abort","interactive"],"backgroundTag":null,"analyzedSha":"6dfeccf2113039e35f2ce735f945e70dc3e4ea45","analyzedAt":"2026-08-16T11:26:17.074Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}