spacedriveapp/spacedrive · info · anyhow::Error

Operation aborted by user

Error message

Operation aborted by user

What it means

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.

Source

Thrown at apps/cli/src/domains/file/mod.rs:159

			};

			let choice_index = prompt_for_choice(request)?;

			// Apply the user's choice to the input
			match choice_index {
				0 => {
					// Overwrite: set conflict resolution in input
					use sd_core::ops::files::copy::action::FileConflictResolution;
					input.on_conflict = Some(FileConflictResolution::Overwrite);
				}
				1 => {
					// Auto-rename: set conflict resolution in input
					use sd_core::ops::files::copy::action::FileConflictResolution;
					input.on_conflict = Some(FileConflictResolution::AutoModifyName);
				}
				2 => {
					// Abort
					anyhow::bail!("Operation aborted by user");
				}
				_ => {
					anyhow::bail!("Invalid choice selected");
				}
			}
		}
	}

	// Execute the action using the input
	let job_id: JobId = execute_action!(ctx, input);
	Ok(job_id)
}

/// Simple conflict detection for CLI
async fn check_for_simple_conflicts(
	action: &sd_core::ops::files::copy::action::FileCopyAction,
) -> Result<bool> {
	use sd_core::domain::addressing::SdPath;

View on GitHub (pinned to 6dfeccf211)

Solutions

  1. Nothing to repair; rerun the copy and pick Overwrite or Auto-rename to proceed.
  2. 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.
  3. In wrappers, treat this specific error as exit code 'cancelled' rather than failure.

Example fix

# before: interactive prompt answered with Abort
sd-cli file copy /data/a.txt /backup/  # prompt -> 3) Abort -> Operation aborted by user

# after: decide up front, no prompt
sd-cli file copy --overwrite /data/a.txt /backup/
Defensive patterns

Strategy: try-catch

Try / catch

match run_copy_with_confirmation(ctx, input).await {
    Err(e) if e.to_string() == "Operation aborted by user" => {
        // clean cancellation: nothing was copied, exit quietly with a distinct code
        std::process::exit(130);
    }
    other => other?,
}

Prevention

When it happens

Trigger: 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).

Common situations: Users pausing at the conflict prompt and deciding not to proceed; scripts run interactively where someone aborts to inspect first.

Related errors


AI-assisted analysis of spacedriveapp/spacedrive@6dfeccf211 (2026-08-16). Data as JSON: /api/errors/1c5e726b67e3d227. Report an issue: GitHub.