{"record":{"id":"1b6a8f7d4fb6c03f","repo":"can1357/oh-my-pi","slug":"operation-is-not-supported-on-a-repository","errorCode":null,"errorMessage":"`{operation}` is not supported on a {} repository","messagePattern":"`(.+?)` is not supported on a (.+?) repository","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"crates/pi-vcs/src/error.rs","lineNumber":101,"sourceCode":"\t/// Filesystem error outside any more specific failure mode.\n\t#[error(transparent)]\n\tIo(#[from] std::io::Error),\n\n\t/// An underlying gix / jj-lib failure that has no dedicated variant.\n\t#[error(\"{context}: {message}\")]\n\tBackend {\n\t\t/// Operation being performed (`\"git status\"`, `\"jj snapshot\"`, …).\n\t\tcontext: &'static str,\n\t\t/// Backend error rendered as text (full source chain).\n\t\tmessage: String,\n\t},\n\n\t/// The operation was canceled via its interrupt flag.\n\t#[error(\"operation canceled\")]\n\tCanceled,\n\t/// The operation has no implementation on this backend (e.g. staged diffs\n\t/// on a Jujutsu workspace, which has no index).\n\t#[error(\n\t\t\"`{operation}` is not supported on a {} repository\",\n\t\tmatch backend {\n\t\t\tcrate::VcsKind::Git => \"git\",\n\t\t\tcrate::VcsKind::Jj => \"jj\",\n\t\t}\n\t)]\n\tUnsupported {\n\t\t/// Operation or feature name as exposed to JS (camelCase).\n\t\toperation: &'static str,\n\t\t/// Backend that lacks it.\n\t\tbackend:   crate::VcsKind,\n\t},\n}\n\nimpl Error {\n\t/// Wrap an arbitrary backend error with the operation it occurred in.\n\tpub fn backend(context: &'static str, err: impl std::fmt::Display) -> Self {\n\t\tSelf::Backend { context, message: err.to_string() }","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/crates/pi-vcs/src/error.rs#L83-L119","documentation":"pi-vcs's VcsError::Unsupported signals that a requested VCS operation has no implementation on the detected backend. Some operations (e.g. staged diffs) only make sense in git, which has an index; a Jujutsu workspace has no index, so the operation is refused instead of silently returning wrong data. The message interpolates the backend kind (`git` or `jj`) and the operation name.","triggerScenarios":"Calling an operation such as staged diff (`git diff --cached` equivalent) on a Vcs instance whose backend is VcsKind::Jj; any Vcs trait method routed to a backend that returns Unsupported for that operation.","commonSituations":"Running the tool in a jj-managed repo (jj colocated with git or pure jj workspace) while code paths assume git semantics; generic tooling that enumerates VCS operations without checking backend capabilities first.","solutions":["Check the repository backend before invoking the operation (e.g. skip or degrade when VcsKind is Jj).","Use a backend-neutral alternative (e.g. working-copy diff instead of a staged/index diff) that both git and jj implement.","If you own the caller, gate the UI/command so it is hidden or labeled N/A for jj repositories."],"exampleFix":"// before\nconst diff = await vcs.stagedDiff();\n// after\nif (vcs.kind === \"jj\") {\n  const diff = await vcs.workingCopyDiff(); // index-free equivalent\n} else {\n  const diff = await vcs.stagedDiff();\n}","handlingStrategy":"validation","validationCode":"if (vcs.kind === VcsKind.Jj && operationNeedsIndex) {\n  // skip or use workingCopyDiff()\n}","typeGuard":null,"tryCatchPattern":"try {\n  await vcs.stagedDiff();\n} catch (err) {\n  if (err instanceof VcsError && err.kind === Unsupported) {\n    return await vcs.workingCopyDiff();\n  }\n  throw err;\n}","preventionTips":["Check VcsKind before invoking index-dependent operations.","Prefer backend-neutral APIs when writing generic VCS tooling.","Feature-detect operations once at startup instead of per-call."],"tags":["vcs","unsupported-operation","jj","git"],"backgroundTag":"vcs-operation-unsupported","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}