can1357/oh-my-pi · error · Error
Cannot resolve revision: ${options.revision}
Error message
Cannot resolve revision: ${options.revision} What it means
When options.revision is supplied, showGitOverlay pins the overlay to that commit by resolving it to a SHA via repo.resolveRef. If the ref cannot be resolved (unknown branch/tag/SHA, or repo handle returned nothing), it throws naming the revision. This validates the pinned revision before building the UI.
Source
Thrown at packages/coding-agent/src/cli/git-tui/index.ts:810
export interface GitTuiOptions {
cwd?: string;
/** Pin the view to one commit (any rev-parse-able revision). */
revision?: string;
}
/**
* Mount the git TUI as a fullscreen overlay on an existing TUI (the `/git`
* slash command). Resolves when the user closes it; the caller restores focus.
*/
export async function showGitOverlay(ui: TUI, options: GitTuiOptions = {}): Promise<void> {
const cwd = options.cwd ?? process.cwd();
const repo = vcs.git(cwd);
const root = repo?.info().repoRoot ?? null;
if (!root) throw new Error(`Not a git repository: ${cwd}`);
let pinnedSha: string | undefined;
if (options.revision) {
pinnedSha = (await repo?.resolveRef(options.revision)) ?? undefined;
if (!pinnedSha) throw new Error(`Cannot resolve revision: ${options.revision}`);
}
const component = new GitTuiComponent(ui, root, pinnedSha);
const overlay = ui.showOverlay(component, {
anchor: "top-left",
width: "100%",
maxHeight: "100%",
margin: 0,
fullscreen: true,
mouseTracking: true,
});
ui.setFocus(component);
ui.requestRender();
try {
await component.run();
} finally {
component.dispose();
// overlay.hide() restores focus to the pre-overlay component.
overlay.hide();View on GitHub (pinned to 9690622007)
Solutions
- Verify the revision exists: `git rev-parse --verify <revision>` in the repo.
- Use the full or correct branch/tag/SHA name.
- Fetch (`git fetch --all --tags`) if the revision exists upstream but not locally.
- Omit options.revision to open the overlay on the current HEAD.
Example fix
// before
await showGitOverlay(ui, { revision: "feature-x" });
// after
if (await repo.resolveRef("feature-x")) await showGitOverlay(ui, { revision: "feature-x" }); Defensive patterns
Strategy: validation
Validate before calling
import { $ } from "bun";
const ok = await $`git -C ${cwd} rev-parse --verify ${revision}`.quiet().nothrow();
if (ok.exitCode !== 0) throw new Error(`Revision not found: ${revision}`); Try / catch
try {
await showGitOverlay(ui, { revision });
} catch (e) {
if (e instanceof Error && e.message.startsWith("Cannot resolve revision")) {
console.error(`Unknown revision "${revision}"; use a branch, tag, or SHA that exists locally.`);
return;
}
throw e;
} Prevention
- Verify revisions with `git rev-parse --verify` before pinning.
- Run `git fetch --tags` so remote branches/tags exist locally.
- Store full 40-char SHAs in tooling that pins revisions.
When it happens
Trigger: Calling showGitOverlay with options.revision set to a string that git cannot resolve — misspelled branch, deleted tag, abbreviated SHA not present, or a ref from another repository.
Common situations: Pinning to a branch that was rebased away or deleted, typos in tag names, passing a full SHA from a different clone, or stale bookkeeping references in tooling.
Related errors
- object not found: {spec}
- Security scans require a Git repository: ${request.cwd}
- local branch ${localBranch} does not exist
- ref_diff preflight requires base_revision and head_revision
- invalid PR number: {pr_number!r}
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/b671e1027afc463f.
Report an issue: GitHub.