{"record":{"id":"ab7f073de67da2b2","repo":"stablyai/orca","slug":"no-worktrees-on-environment-envname-ab7f07","errorCode":null,"errorMessage":"No worktrees on environment ${envName}","messagePattern":"No worktrees on environment (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"config/scripts/live-remote-realistic-freeze-repro.mjs","lineNumber":162,"sourceCode":"  const notes = []\n  const phases = []\n  const openTimings = new BoundedLiveFreezeHistory(100)\n\n  console.log(\n    `[realistic-freeze] scenario=${scenario} env=${envName} create=${createCount} idleMs=${idleMs} openCount=${openCount} paceMs=${paceMs}`\n  )\n\n  const local = orcaJsonSync(['status'], { local: true })\n  const remote = orcaJsonSync(['status'])\n  notes.push(\n    `local version=${local.result?.runtime?.appVersion} pid=${local.result?.app?.pid}`,\n    `remote version=${remote.result?.runtime?.appVersion} state=${remote.result?.runtime?.state}`\n  )\n\n  const worktrees = orcaJsonSync(['worktree', 'list']).result\n  const wtList = worktrees?.worktrees || worktrees?.items || worktrees || []\n  if (!Array.isArray(wtList) || wtList.length === 0) {\n    throw new Error(`No worktrees on environment ${envName}`)\n  }\n  notes.push(`remote worktrees=${wtList.length}`)\n  phases.push({ phase: 'baseline', worktrees: wtList.length })\n\n  // --- Phase: seed flood terminals (agent-like backlog sources) ---\n  const created = []\n  if (createCount > 0) {\n    const targets = wtList.slice(0, Math.min(createWorktreeSpan, wtList.length))\n    await mapPool(\n      Array.from({ length: createCount }, (_, i) => i),\n      Math.min(4, createCount),\n      async (i) => {\n        const wt = targets[i % targets.length]\n        const selector = worktreeSelector(wt)\n        if (!selector) {\n          return\n        }\n        const marker = `REALISTIC_${Date.now()}_${i}`","sourceCodeStart":144,"sourceCodeEnd":180,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/config/scripts/live-remote-realistic-freeze-repro.mjs#L144-L180","documentation":"Mirror of error 102 in the realistic-freeze repro: the script enumerates remote worktrees via 'orca worktree list' and aborts when the resolved list is empty or not an array. Worktrees are required because the create phase fans terminal opens across wtList.slice targets.","triggerScenarios":"Realistic repro run against a remote with no registered worktrees, or a 'worktree list' payload whose shape (worktrees/items/bare array) does not match the fallback chain so it resolves to [].","commonSituations":"Fresh or uninitialized remote, worktree index reset, version skew changing the RPC envelope, or an SSH target without checked-out worktrees.","solutions":["Verify 'orca worktree list' returns a non-empty array against the same envName before running the repro.","Initialize/register at least one worktree on the target environment.","Update the wtList fallback chain to match the current 'worktree list' envelope if the version changed."],"exampleFix":"// before\nconst wtList = worktrees?.worktrees || worktrees?.items || worktrees || []\nif (!Array.isArray(wtList) || wtList.length === 0) throw new Error(`No worktrees on environment ${envName}`)\n\n// after\nconst wtList = worktrees?.worktrees ?? worktrees?.items ?? worktrees ?? []\nif (!Array.isArray(wtList) || wtList.length === 0) {\n  throw new Error(`No worktrees on environment ${envName}; payload=${JSON.stringify(worktrees).slice(0,200)}`)\n}","handlingStrategy":"validation","validationCode":"const wtList = (await orca('worktree list'))?.worktrees ?? []\nif (!Array.isArray(wtList) || wtList.length === 0) {\n  throw new Error(`Pre-check: no worktrees on ${envName}; initialize at least one`)\n}","typeGuard":"const isNonEmptyWorktreeArray = (r) => Array.isArray(r) && r.length > 0","tryCatchPattern":"try {\n  runRealisticRepro(envName)\n} catch (e) {\n  if (/No worktrees/.test(e.message)) { await ensureWorktrees(envName); runRealisticRepro(envName) }\n  else throw e\n}","preventionTips":["Pre-flight 'worktree list' in the harness with a clearer message.","Pin the certified remote orca version.","Log the raw envelope when empty to detect version-driven shape drift."],"tags":["worktree","git","environment","validation"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}