can1357/oh-my-pi · error · RuntimeError

omp agent error (stopReason=error): {error_msg}

Error message

omp agent error (stopReason=error): {error_msg}

What it means

run_task's RPC driver raises RuntimeError('omp agent error (stopReason=error): {error_msg}') when the omp --mode rpc turn finishes normally but its assistant_message reports stopReason 'error'. The message forwards the underlying errorMessage from the agent (or 'model returned error' when absent), meaning the agent subprocess ended its turn with an error rather than a result.

Source

Thrown at python/robomp/src/worker.py:778

                turn = _drive_turn(
                    client,
                    prompt,
                    task_kind=task_kind,
                    inputs=inputs,
                    bindings=bindings,
                    tools_called=tools_called,
                )
                if turn is None:
                    return None
            finally:
                hard_timer.cancel()
            if hard_timeout_fired.is_set():
                raise TimeoutError("omp task exceeded hard timeout")
            if turn is not None and turn.assistant_message is not None:
                stop_reason = turn.assistant_message.get("stopReason")
                if stop_reason == "error":
                    error_msg = turn.assistant_message.get("errorMessage") or "model returned error"
                    raise RuntimeError(f"omp agent error (stopReason=error): {error_msg}")
            log.info(
                "rpc_done",
                extra={
                    "issue": bindings.issue_key,
                    "task": task_kind,
                    "messages": len(turn.messages),
                    "events": len(turn.events),
                },
            )
            return turn.assistant_text
        finally:
            unregister_cancel_hook()


async def run_task(
    *,
    task_kind: str,
    inputs: TaskInputs,

View on GitHub (pinned to 9690622007)

Solutions

  1. Read the appended {error_msg} in events.last_error — it carries the underlying omp errorMessage with the provider's reason.
  2. Verify model/provider credentials and that ROBOMP_MODEL (and ROBOMP_PROVIDER/ROBOMP_THINKING) name a valid, affordable model for the account.
  3. Check the LLM gateway health; transient 429/5xx outages just need a retry (POST /api/trigger with the delivery_id).
  4. If it is context overflow on a resumed session, use robomp cleanup owner/repo#N or trigger a fresh triage to start a new session.
  5. Reproduce locally with the same omp command (omp --mode rpc) to get the full provider error outside the orchestrator.
Defensive patterns

Strategy: try-catch

Validate before calling

// verify provider config before dispatching
if (!process.env.ROBOMP_MODEL) throw new Error('ROBOMP_MODEL unset');
// and validate the gateway answers:
const ok = (await fetch(`${gatewayUrl}/healthz`)).ok;

Type guard

function isAgentErrorTurn(msg: Record<string, unknown> | null | undefined): boolean {
  return !!msg && msg.stopReason === 'error';
}

Try / catch

try {
  result = await runTask(...);
} catch (e) {
  if (e instanceof RuntimeError && e.message.includes('omp agent error')) {
    const detail = e.message.split(': ').slice(1).join(': ');
    log.error('omp agent failed', { detail });
    if (/429|rate limit/i.test(detail)) await backoffAndRetry(deliveryId);
  } else throw e;
}

Prevention

When it happens

Trigger: The omp subprocess returns a turn whose assistant_message.stopReason == 'error' — model/provider API failures (auth, quota, rate limit), the agent hitting a fatal internal error, invalid model configuration, or the gateway rejecting the request mid-session.

Common situations: Expired/invalid provider credentials in models.yml or env; provider outage or 429/5xx from the LLM gateway; ROBOMP_MODEL naming a model the provider rejects; context overflow on long resumed sessions; provider returns an empty/error completion that omp surfaces as stopReason=error.

Related errors


AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31). Data as JSON: /api/errors/0ad2e699363ab034. Report an issue: GitHub.