nanocoai/nanoclaw · warning

Echo fan write failed

Error message

Echo fan write failed

What it means

While fanning an inbound/outbound message to other sessions (cross-session echo), writing to one target session's inbound DB failed. The failure is isolated per-target so remaining targets still receive the message.

Source

Thrown at src/modules/cross-session-context/fan.ts:172

  let written = 0;
  for (const target of targets) {
    try {
      await writeSessionMessage(input.agentGroupId, target.id, {
        id: echoRowId(input.origMessageId, target.id),
        kind: 'chat',
        timestamp: input.timestamp,
        platformId: input.platformId,
        channelType: ECHO_CHANNEL_TYPE,
        threadId: null,
        content,
        trigger: false,
        sourceSessionId: input.sourceSessionId,
      });
      written++;
    } catch (err) {
      // Per-target isolation: one broken session DB (or a duplicate id from a
      // replay) must not stop the rest of the fan — or, upstream, routing.
      log.warn('Echo fan write failed', {
        targetSessionId: target.id,
        origMessageId: input.origMessageId,
        err,
      });
    }
  }
  return written;
}

/**
 * Router hook: fan a just-written trigger=1 inbound message into sibling
 * sessions. Call ONLY for the engaged (wake) branch — accumulate (trigger=0)
 * writes must never fan (D3). Never throws; returns rows written.
 */
export async function fanInboundMessage(args: {
  /** Source session the trigger=1 row was written to. */
  session: Session;
  /** Messaging group the message arrived on (the source surface). */

View on GitHub (pinned to 294ef2aee8)

Solutions

  1. Inspect data/v2-sessions/<targetSessionId>/inbound.db for corruption or lock contention
  2. Verify the session directory and mount exist and the host has write access
  3. Re-run or replay the fan for the affected target once the DB is healthy
Defensive patterns

Strategy: fallback

Validate before calling

for (const target of targets) {
  try { await writeEcho(target, input); }
  catch (err) { log.warn('Echo fan write failed', { target: target.id, err }); }
}

Try / catch

catch (err) { /* per-target isolation */ log.warn('Echo fan write failed', { targetSessionId: target.id, err }); }

Prevention

When it happens

Trigger: A target session's inbound.db is corrupted, locked, or the mount is missing; duplicate message id from a replay violates a uniqueness constraint; disk full on the session data volume.

Common situations: Session directory deleted mid-fan; concurrent host writes contending on the SQLite file; replaying routed messages after a restore.

Related errors


AI-assisted analysis of nanocoai/nanoclaw@294ef2aee8 (2026-08-28). Data as JSON: /api/errors/b32a3336fc6d4639. Report an issue: GitHub.