NousResearch/hermes-agent · warning · Error

Content too large

Error message

Content too large

What it means

writeText deliberately caps content at 1,000,000 characters so the IPC cannot be abused as a bulk-write primitive; a longer string throws 'Content too large'. The cap is checked before path resolution, so it fires regardless of whether the target path is valid.

Source

Thrown at apps/desktop/electron/main.ts:11799

  return { path: dst }
})

// Write a small UTF-8 text file (e.g. a project's IDEA.md at creation). The path
// is hardened (resolveRequestedPathForIpc) and the parent must already exist —
// this never creates directory trees or escapes the allowed roots, and content
// is size-capped so it can't be abused as a bulk-write primitive.
ipcMain.handle('hermes:fs:writeText', async (_event, filePath, content) => {
  const raw = String(filePath || '').trim()

  if (!raw) {
    throw new Error('Invalid path')
  }

  const text = String(content ?? '')

  if (text.length > 1_000_000) {
    throw new Error('Content too large')
  }

  const resolved = resolveRequestedPathForIpc(expandUserPath(raw), { purpose: 'Write text file' })

  if (!directoryExists(path.dirname(resolved))) {
    throw new Error('Parent directory does not exist')
  }

  await fs.promises.writeFile(resolved, text, 'utf8')

  return { path: resolved }
})

// Move a file/folder to the OS trash (recoverable) — the VS Code "Delete"
// default. `shell.trashItem` routes to Finder/Explorer/Files trash per platform.
ipcMain.handle('hermes:fs:trash', async (_event, targetPath) => {
  const target = String(targetPath || '').trim()

View on GitHub (pinned to c896c09c42)

Solutions

  1. Reduce the content below 1,000,000 characters — this API is for small metadata files, not bulk data
  2. Move large content to a real file via normal file tools / terminal instead of the writeText IPC
  3. Add a client-side length check with a visible counter before submit

Example fix

// before
await ipc.invoke('hermes:fs:writeText', path, text)

// after
if (text.length > 1_000_000) throw new Error('Note too large — trim below 1,000,000 chars')
await ipc.invoke('hermes:fs:writeText', path, text)
Defensive patterns

Strategy: validation

Validate before calling

const MAX = 1_000_000
if ((content ?? '').length > MAX) { notify(`Content exceeds ${MAX} characters`); return }
await ipc.invoke('hermes:fs:writeText', filePath, content)

Type guard

function withinWriteTextCap(text: string): boolean { return text.length <= 1_000_000 }

Try / catch

catch (e) { if (e instanceof Error && e.message === 'Content too large') notify('Trim the content below 1,000,000 characters') else throw e }

Prevention

When it happens

Trigger: Passing text.length > 1_000_000 to hermes:fs:writeText — e.g. pasting a huge document into an IDEA.md editor, or a bug that serializes an entire project/log into the write payload.

Common situations: Users pasting large generated content into a small-file field; code that accidentally passes a full file tree or concatenated logs as 'content'.

Related errors


AI-assisted analysis of NousResearch/hermes-agent@c896c09c42 (2026-08-14). Data as JSON: /api/errors/545a15c5054008c7. Report an issue: GitHub.