can1357/oh-my-pi · info · Error
operation canceled
Error message
operation canceled
What it means
Error::Canceled indicates the operation was aborted via its interrupt/cancellation flag before completing. This is an expected control-flow signal, not a malfunction: a caller (or embedding UI) asked the library to stop, and the library unwound with this sentinel.
Source
Thrown at crates/pi-vcs/src/error.rs:97
/// Rendered command line.
command: String,
},
/// Filesystem error outside any more specific failure mode.
#[error(transparent)]
Io(#[from] std::io::Error),
/// An underlying gix / jj-lib failure that has no dedicated variant.
#[error("{context}: {message}")]
Backend {
/// Operation being performed (`"git status"`, `"jj snapshot"`, …).
context: &'static str,
/// Backend error rendered as text (full source chain).
message: String,
},
/// The operation was canceled via its interrupt flag.
#[error("operation canceled")]
Canceled,
/// The operation has no implementation on this backend (e.g. staged diffs
/// on a Jujutsu workspace, which has no index).
#[error(
"`{operation}` is not supported on a {} repository",
match backend {
crate::VcsKind::Git => "git",
crate::VcsKind::Jj => "jj",
}
)]
Unsupported {
/// Operation or feature name as exposed to JS (camelCase).
operation: &'static str,
/// Backend that lacks it.
backend: crate::VcsKind,
},
}
View on GitHub (pinned to 9690622007)
Solutions
- Treat this variant as benign: catch it and clean up without reporting an error to the user.
- If cancellation was unintended, audit where the interrupt flag is set (shared flag, stale UI state) and reset it before starting new operations.
- Retrigger the operation with a fresh, unset interrupt flag.
- In batch pipelines, decide per-batch whether to continue remaining items or abort the whole batch on cancel.
Example fix
// before
let result = op.run()?; // Canceled bubbles up as an error toast
// after
match op.run() {
Err(Error::Canceled) => Ok(None), // user aborted — not an error
other => other.map(Some),
} Defensive patterns
Strategy: try-catch
Type guard
fn is_canceled(err: &pi_vcs::Error) -> bool {
matches!(err, pi_vcs::Error::Canceled)
} Try / catch
match operation.run(interrupt_flag) {
Err(pi_vcs::Error::Canceled) => {
// user-initiated abort: report nothing, clean up quietly
cleanup_partial_state();
}
other => other?,
} Prevention
- Reset the interrupt flag before starting each new operation.
- Route all user-cancel actions through the flag, and handle the Canceled variant explicitly everywhere you run operations.
- Distinguish Canceled from real errors in error-reporting UI so aborts never show as failures.
- Avoid sharing one interrupt flag across unrelated concurrent operations.
When it happens
Trigger: Setting the operation's interrupt flag during a long-running scan/status/log while it is in flight: user pressing Escape in a TUI, request cancellation in an RPC handler, or a supervisor cancelling a batch of VCS operations partway through.
Common situations: Users cancelling a slow `git log`/status search in an editor plugin, timeout controllers that flip the interrupt flag, or app shutdown racing an in-progress VCS read.
Related errors
- aborted
- ToolAbortError (operation aborted)
- not a repository: {path}
- reference not found: {name}
- object not found: {spec}
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/16715ce2a020625f.
Report an issue: GitHub.