stablyai/orca · error · Error

No worktrees on environment ${envName}

Error message

No worktrees on environment ${envName}

What it means

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.

Source

Thrown at config/scripts/live-remote-realistic-freeze-repro.mjs:162

  const notes = []
  const phases = []
  const openTimings = new BoundedLiveFreezeHistory(100)

  console.log(
    `[realistic-freeze] scenario=${scenario} env=${envName} create=${createCount} idleMs=${idleMs} openCount=${openCount} paceMs=${paceMs}`
  )

  const local = orcaJsonSync(['status'], { local: true })
  const remote = orcaJsonSync(['status'])
  notes.push(
    `local version=${local.result?.runtime?.appVersion} pid=${local.result?.app?.pid}`,
    `remote version=${remote.result?.runtime?.appVersion} state=${remote.result?.runtime?.state}`
  )

  const worktrees = orcaJsonSync(['worktree', 'list']).result
  const wtList = worktrees?.worktrees || worktrees?.items || worktrees || []
  if (!Array.isArray(wtList) || wtList.length === 0) {
    throw new Error(`No worktrees on environment ${envName}`)
  }
  notes.push(`remote worktrees=${wtList.length}`)
  phases.push({ phase: 'baseline', worktrees: wtList.length })

  // --- Phase: seed flood terminals (agent-like backlog sources) ---
  const created = []
  if (createCount > 0) {
    const targets = wtList.slice(0, Math.min(createWorktreeSpan, wtList.length))
    await mapPool(
      Array.from({ length: createCount }, (_, i) => i),
      Math.min(4, createCount),
      async (i) => {
        const wt = targets[i % targets.length]
        const selector = worktreeSelector(wt)
        if (!selector) {
          return
        }
        const marker = `REALISTIC_${Date.now()}_${i}`

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Verify 'orca worktree list' returns a non-empty array against the same envName before running the repro.
  2. Initialize/register at least one worktree on the target environment.
  3. Update the wtList fallback chain to match the current 'worktree list' envelope if the version changed.

Example fix

// before
const wtList = worktrees?.worktrees || worktrees?.items || worktrees || []
if (!Array.isArray(wtList) || wtList.length === 0) throw new Error(`No worktrees on environment ${envName}`)

// after
const wtList = worktrees?.worktrees ?? worktrees?.items ?? worktrees ?? []
if (!Array.isArray(wtList) || wtList.length === 0) {
  throw new Error(`No worktrees on environment ${envName}; payload=${JSON.stringify(worktrees).slice(0,200)}`)
}
Defensive patterns

Strategy: validation

Validate before calling

const wtList = (await orca('worktree list'))?.worktrees ?? []
if (!Array.isArray(wtList) || wtList.length === 0) {
  throw new Error(`Pre-check: no worktrees on ${envName}; initialize at least one`)
}

Type guard

const isNonEmptyWorktreeArray = (r) => Array.isArray(r) && r.length > 0

Try / catch

try {
  runRealisticRepro(envName)
} catch (e) {
  if (/No worktrees/.test(e.message)) { await ensureWorktrees(envName); runRealisticRepro(envName) }
  else throw e
}

Prevention

When it happens

Trigger: 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 [].

Common situations: Fresh or uninitialized remote, worktree index reset, version skew changing the RPC envelope, or an SSH target without checked-out worktrees.

Related errors


AI-assisted analysis of stablyai/orca@1136503c6a (2026-08-12). Data as JSON: /api/errors/ab7f073de67da2b2. Report an issue: GitHub.