nanocoai/nanoclaw · warning
inbox-safety: failed to resolve inbox dir
Error message
inbox-safety: failed to resolve inbox dir
What it means
Resolving/realpath-ing an intended inbox directory threw — e.g. a parent disappeared mid-resolution (ENOENT on realpath), permission denied, or a symlink loop. The operation returns null and the caller treats the inbox path as unusable (attachment extraction is skipped).
Source
Thrown at src/inbox-safety.ts:80
return null;
}
} catch {
// Does not exist yet — fine, mkdir below creates it.
}
}
fs.mkdirSync(inboxDir, { recursive: true });
try {
const realInboxDir = fs.realpathSync(inboxDir);
const realInboxRoot = fs.realpathSync(inboxRoot);
if (!isPathInside(realInboxRoot, realInboxDir)) {
log.warn('inbox-safety: inbox dir escaped inbox root', { ...context, inboxDir });
return null;
}
return realInboxDir;
} catch (err) {
log.warn('inbox-safety: failed to resolve inbox dir', { ...context, inboxDir, err });
return null;
}
}
View on GitHub (pinned to 294ef2aee8)
Solutions
- Check the inboxDir in the log exists and all parents are traversable (x bit)
- Avoid symlinks in the data/ tree
- Retry the attachment send — transient races usually clear
Defensive patterns
Strategy: validation
Validate before calling
import fs from 'node:fs'; const p = fs.realpathSync(inboxDir); // pre-validate before extracting attachments if (!p.startsWith(realInboxRoot)) abort();
Type guard
function isSafeInboxDir(dir: string, root: string): boolean {
try { return fs.realpathSync(dir).startsWith(fs.realpathSync(root) + '/'); } catch { return false; }
} Try / catch
const safe = ensureContainedInboxDir(dir); if (!safe) skipAttachmentExtraction();
Prevention
- Keep data/v2-sessions on a real (non-symlinked) local path
- Don't delete/recreate session dirs while messages flow
- Retry attachment sends after transient races
When it happens
Trigger: ensureContainedInboxDir's fs.realpath calls throw on a missing/renamed session dir, an unreadable parent, or a symlinked path segment.
Common situations: Session directory recreated concurrently (container restart race), permission changes on data/v2-sessions, or symlinked data dirs.
Related errors
- agent-route: failed to inspect source outbox dir
- inbox-safety: rejecting unsafe inbox path
- inbox-safety: inbox dir escaped inbox root
- Unknown provider: ${name}. Registered: ${known}
- engage_mode '${w.engage_mode}' can never engage on channel '
AI-assisted analysis of nanocoai/nanoclaw@294ef2aee8 (2026-08-28).
Data as JSON: /api/errors/3c4d4b1d014bc1e1.
Report an issue: GitHub.