{"record":{"id":"b671e1027afc463f","repo":"can1357/oh-my-pi","slug":"cannot-resolve-revision-options-revision","errorCode":null,"errorMessage":"Cannot resolve revision: ${options.revision}","messagePattern":"Cannot resolve revision: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/cli/git-tui/index.ts","lineNumber":810,"sourceCode":"export interface GitTuiOptions {\n\tcwd?: string;\n\t/** Pin the view to one commit (any rev-parse-able revision). */\n\trevision?: string;\n}\n\n/**\n * Mount the git TUI as a fullscreen overlay on an existing TUI (the `/git`\n * slash command). Resolves when the user closes it; the caller restores focus.\n */\nexport async function showGitOverlay(ui: TUI, options: GitTuiOptions = {}): Promise<void> {\n\tconst cwd = options.cwd ?? process.cwd();\n\tconst repo = vcs.git(cwd);\n\tconst root = repo?.info().repoRoot ?? null;\n\tif (!root) throw new Error(`Not a git repository: ${cwd}`);\n\tlet pinnedSha: string | undefined;\n\tif (options.revision) {\n\t\tpinnedSha = (await repo?.resolveRef(options.revision)) ?? undefined;\n\t\tif (!pinnedSha) throw new Error(`Cannot resolve revision: ${options.revision}`);\n\t}\n\tconst component = new GitTuiComponent(ui, root, pinnedSha);\n\tconst overlay = ui.showOverlay(component, {\n\t\tanchor: \"top-left\",\n\t\twidth: \"100%\",\n\t\tmaxHeight: \"100%\",\n\t\tmargin: 0,\n\t\tfullscreen: true,\n\t\tmouseTracking: true,\n\t});\n\tui.setFocus(component);\n\tui.requestRender();\n\ttry {\n\t\tawait component.run();\n\t} finally {\n\t\tcomponent.dispose();\n\t\t// overlay.hide() restores focus to the pre-overlay component.\n\t\toverlay.hide();","sourceCodeStart":792,"sourceCodeEnd":828,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/cli/git-tui/index.ts#L792-L828","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nawait showGitOverlay(ui, { revision: \"feature-x\" });\n// after\nif (await repo.resolveRef(\"feature-x\")) await showGitOverlay(ui, { revision: \"feature-x\" });","handlingStrategy":"validation","validationCode":"import { $ } from \"bun\";\nconst ok = await $`git -C ${cwd} rev-parse --verify ${revision}`.quiet().nothrow();\nif (ok.exitCode !== 0) throw new Error(`Revision not found: ${revision}`);","typeGuard":null,"tryCatchPattern":"try {\n  await showGitOverlay(ui, { revision });\n} catch (e) {\n  if (e instanceof Error && e.message.startsWith(\"Cannot resolve revision\")) {\n    console.error(`Unknown revision \"${revision}\"; use a branch, tag, or SHA that exists locally.`);\n    return;\n  }\n  throw e;\n}","preventionTips":["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."],"tags":["git","revision","validation"],"backgroundTag":"unresolvable-git-revision","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}