nanocoai/nanoclaw · warning

Message delivery failed, will retry

Error message

Message delivery failed, will retry

What it means

Delivering an outbound message via the channel adapter failed (non-marking error path); the message stays pending and will be retried up to MAX_DELIVERY_ATTEMPTS. Includes the attempt counter and underlying error for diagnosis.

Source

Thrown at src/delivery.ts:271

      if (attempts >= MAX_DELIVERY_ATTEMPTS) {
        log.error('Message delivery failed permanently, giving up', {
          messageId: msg.id,
          sessionId: session.id,
          attempts,
          err,
        });
        try {
          await withExistingMailboxSession(agentGroup.id, session.id, (mailbox) => mailbox.markDeliveryFailed(msg.id));
          deliveryAttempts.delete(msg.id);
        } catch (markErr) {
          log.error('Failed to record permanent delivery failure', {
            messageId: msg.id,
            sessionId: session.id,
            err: markErr,
          });
        }
      } else {
        log.warn('Message delivery failed, will retry', {
          messageId: msg.id,
          sessionId: session.id,
          attempt: attempts,
          maxAttempts: MAX_DELIVERY_ATTEMPTS,
          err,
        });
      }
    }
  }
}

async function deliverMessage(
  msg: {
    id: string;
    kind: string;
    platformId: string | null;
    channelType: string | null;
    threadId: string | null;

View on GitHub (pinned to 294ef2aee8)

Solutions

  1. Inspect `err` in the same log line and `logs/nanoclaw.error.log` for the adapter failure
  2. Fix the credential (re-auth the channel) or wait out a rate limit/outage; retries resume automatically
  3. If attempts exhaust, check the channel adapter's health and re-send from the session
Defensive patterns

Strategy: retry

Try / catch

try { await adapter.send(msg); } catch (err) { /* backoff; inspect err; only mark delivered on success */ }

Prevention

When it happens

Trigger: `drainSession` → adapter send throws (network error, channel API 5xx/rate limit, expired token) for a message in outbound.db; message not yet marked delivered.

Common situations: Channel outage or rate limiting; revoked bot token; transient DNS/network failure on the host.

Related errors


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