{"record":{"id":"f380301ff518d967","repo":"diegosouzapw/OmniRoute","slug":"git-tag-not-found-targettag","errorCode":null,"errorMessage":"Git tag not found: ${targetTag}","messagePattern":"Git tag not found: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/lib/system/autoUpdate.ts","lineNumber":278,"sourceCode":"      composeCommand: null,\n    };\n  }\n\n  return { supported: true, reason: null, composeCommand };\n}\n\nexport async function ensureGitTagExists(\n  targetTag: string,\n  execFileImpl: ExecFileLike = execFileAsync,\n  cwd = PROJECT_ROOT\n): Promise<void> {\n  try {\n    await execFileImpl(\"git\", [\"rev-parse\", \"-q\", \"--verify\", `refs/tags/${targetTag}`], {\n      timeout: 10_000,\n      cwd,\n    });\n  } catch {\n    throw new Error(`Git tag not found: ${targetTag}`);\n  }\n}\n\nexport function buildNpmUpdateScript(latest: string): string {\n  return [\n    \"set -eu\",\n    // --include=optional keeps the optionalDependencies (better-sqlite3, keytar,\n    // tls-client, and the llmlingua SLM stack) installed on every update so an\n    // `omit=optional` config / .npmrc cannot silently drop them.\n    `npm install -g omniroute@${latest} --include=optional --ignore-scripts --legacy-peer-deps`,\n    \"if command -v pm2 >/dev/null 2>&1; then\",\n    \"  pm2 restart omniroute || true\",\n    \"fi\",\n    `echo \\\"[AutoUpdate] Successfully updated to v${latest}.\\\"`,\n  ].join(\"\\n\");\n}\n\nexport function buildSourceUpdateScript(latest: string, gitRemote = \"origin\"): string {","sourceCodeStart":260,"sourceCodeEnd":296,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/lib/system/autoUpdate.ts#L260-L296","documentation":"Pre-flight guard in ensureGitTagExists: `git rev-parse -q --verify refs/tags/<targetTag>` failed in PROJECT_ROOT (tag absent or git errored, 10s timeout). Auto-update refuses to proceed to a tag that does not exist locally because the update script would checkout/deploy an unresolvable ref.","triggerScenarios":"Thrown at src/lib/system/autoUpdate.ts:278 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Run `git fetch --tags` to bring the tag locally and retry","Verify the tag name is exactly as published (leading 'v', etc.)","If the repo is shallow, unshallow it so tags are visible"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d","analyzedAt":"2026-08-25T18:35:09.898Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}