moeru-ai/airi · error · Error

Godot stage bridge is not connected.

Error message

Godot stage bridge is not connected.

What it means

Thrown by sendViewRequest after currentStatus.state === 'running' passed but sendSocketMessage returned false — meaning currentSocketPeer is null/absent. So the stage is marked running but the websocket bridge peer (the Godot process connection) is not established, making it impossible to deliver the host.view.* message.

Source

Thrown at apps/stage-tamagotchi/src/main/services/airi/godot-stage/index.ts:481

  }

  function sendSocketMessage(type: string, payload?: unknown) {
    if (!currentSocketPeer) {
      return false
    }

    currentSocketPeer.send(createSocketEnvelope(type, payload))
    return true
  }

  function sendViewRequest(type: 'host.view.patch' | 'host.view.request_snapshot', payload: Record<string, unknown> = {}) {
    if (currentStatus.state !== 'running') {
      throw new Error('Godot stage is not running.')
    }

    const requestId = randomUUID()
    if (!sendSocketMessage(type, { requestId, ...payload })) {
      throw new Error('Godot stage bridge is not connected.')
    }

    return { requestId }
  }

  function sendSceneInputToGodot(payload: GodotStageSceneApplyPayload) {
    if (!sendSocketMessage('host.scene.apply', payload)) {
      throw new Error('Godot stage bridge is not connected.')
    }
  }

  function handleSocketMessage(message: GodotStageSocketEnvelope) {
    switch (message.type) {
      case 'stage.ready': {
        setStatus({
          state: 'running',
          pid: currentProcess?.pid ?? null,
          lastError: undefined,

View on GitHub (pinned to 27111382b4)

Solutions

  1. Treat as transient: retry after a short delay, or restart the Godot stage with electronGodotStageStart to re-establish the peer.
  2. Check electronGodotStageGetStatus and the lastError field for an underlying socket/process failure.
  3. Ensure the socket runtime (startSocketRuntime) stayed up alongside the Godot process.
Defensive patterns

Strategy: retry

Try / catch

try {
  await electronGodotStageApplyViewPatch({ patches })
}
catch (error) {
  if (errorMessageFrom(error) === 'Godot stage bridge is not connected.') {
    // transient: restart the stage, then retry once
    await electronGodotStageStart()
    await electronGodotStageApplyViewPatch({ patches })
  }
}

Prevention

When it happens

Trigger: The Godot process is alive enough to have set state 'running' but the inbound websocket peer disconnected or was never assigned to currentSocketPeer; transient window between the process starting and the socket peer opening; peer dropped mid-session.

Common situations: Godot process crashed but the 'stopped' status didn't propagate yet; websocket connection from Godot dropped due to restart of the socket runtime; race between setStatus('running') and peer assignment.

Related errors


AI-assisted analysis of moeru-ai/airi@27111382b4 (2026-08-12). Data as JSON: /api/errors/bb0a18d0d1c48cf5. Report an issue: GitHub.