{"record":{"id":"f04f7fd6b9e7941c","repo":"stablyai/orca","slug":"no-worktrees-on-environment-envname","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-bulk-open-freeze-repro.mjs","lineNumber":107,"sourceCode":"  const notes = []\n  const timings = new BoundedLiveFreezeHistory(120)\n  const amplificationSteps = []\n\n  console.log(\n    `[live-freeze] env=${envName} create=${createCount} passes=${switchPasses} parallel=${parallel}`\n  )\n\n  const status = orcaJsonSync(['status'])\n  notes.push(\n    `remote version=${status.result?.runtime?.appVersion} state=${status.result?.runtime?.state}`\n  )\n  const local = orcaJsonSync(['status'], { local: true })\n  notes.push(`local version=${local.result?.runtime?.appVersion} pid=${local.result?.app?.pid}`)\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  amplificationSteps.push(`baseline worktrees=${wtList.length}`)\n\n  const targets = wtList.slice(0, Math.min(createWorktreeSpan, wtList.length))\n  const created = []\n\n  // Parallel flood-terminal creates across many worktrees.\n  if (createCount > 0) {\n    amplificationSteps.push(`create=${createCount} parallel=${Math.min(parallel, createCount)}`)\n    const createJobs = Array.from({ length: createCount }, (_, i) => i)\n    await mapPool(createJobs, Math.min(parallel, createCount), async (i) => {\n      const wt = targets[i % targets.length]\n      const selector = worktreeSelector(wt)\n      if (!selector) {\n        notes.push(`create ${i} skipped: no selector`)\n        return\n      }","sourceCodeStart":89,"sourceCodeEnd":125,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/config/scripts/live-remote-bulk-open-freeze-repro.mjs#L89-L125","documentation":"The bulk-open freeze repro script first enumerates worktrees via 'orca worktree list' and refuses to proceed if the returned list is empty or not an array. Worktrees are the substrate the script fans terminal-create operations across, so with zero worktrees the parallel flood-create and switch amplification could not target anything meaningful. The guard also catches a malformed RPC payload where worktrees/worktrees.items/items are all missing.","triggerScenarios":"Running the repro against a remote environment whose orca state has no registered worktrees, or where 'worktree list' returns an unexpected shape (no .worktrees, .items, or bare array). The fallback chain wtList = worktrees?.worktrees || worktrees?.items || worktrees || [] resolves to [] when the payload is null/empty.","commonSituations":"Pointing ORCA env at a fresh/uninitialized remote, a remote whose worktree index was reset, a version mismatch where 'worktree list' emits a different envelope, or an SSH target whose repo has no worktrees checked out.","solutions":["Run 'orca worktree list' manually against the same target and confirm at least one worktree is registered before invoking the repro.","Ensure the env name (envName) resolves to a fully initialized orca environment with checked-out worktrees.","If the RPC shape changed between versions, update the wtList fallback chain to match the current 'worktree list' envelope."],"exampleFix":"// before\nconst worktrees = orcaJsonSync(['worktree', 'list']).result\nconst wtList = worktrees?.worktrees || worktrees?.items || worktrees || []\nif (!Array.isArray(wtList) || wtList.length === 0) throw new Error(...)\n\n// after\nconst worktrees = orcaJsonSync(['worktree', 'list']).result\nconst wtList = worktrees?.worktrees ?? worktrees?.items ?? worktrees ?? []\nif (!Array.isArray(wtList) || wtList.length === 0) {\n  console.error('worktree list payload:', JSON.stringify(worktrees))\n  throw new Error(`No worktrees on environment ${envName}`)\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}; run 'orca worktree add' first`)\n}","typeGuard":"const isNonEmptyWorktreeArray = (r) => Array.isArray(r) && r.length > 0 && typeof r[0]?.id === 'string'","tryCatchPattern":"try {\n  runRepro(envName)\n} catch (e) {\n  if (/No worktrees/.test(e.message)) { await ensureWorktrees(envName); runRepro(envName) }\n  else throw e\n}","preventionTips":["Pre-flight 'orca worktree list' in the harness and abort with a clearer message before the repro.","Pin the remote orca version the repro is certified against.","Log the raw 'worktree list' payload when the list resolves empty to catch envelope 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"}