stablyai/orca · warning · Error

File too large: ${(buffer.byteLength / 1024 / 1024).toFixed(

Error message

File too large: ${(buffer.byteLength / 1024 / 1024).toFixed(1)}MB exceeds ${MAX_TEXT_FILE_SIZE / 1024 / 1024}MB limit

What it means

Thrown by readLocalLogSnapshot as a secondary size check after reading the buffer. Even though the pre-read stat passed, the buffer's actual byteLength is checked again. This catches files that grew between the stat and the readFile call, ensuring the in-memory buffer never exceeds MAX_TEXT_FILE_SIZE (50 MB).

Source

Thrown at src/main/ipc/filesystem.ts:184

  '.ico': 'image/x-icon',
  '.pdf': 'application/pdf'
}
async function readLocalLogSnapshot(filePath: string): Promise<{
  content: string
  isBinary: boolean
  fileIdentity?: string
}> {
  const handle = await open(filePath, 'r')
  try {
    const stats = await handle.stat()
    if (stats.size > MAX_TEXT_FILE_SIZE) {
      throw new Error(
        `File too large: ${(stats.size / 1024 / 1024).toFixed(1)}MB exceeds ${MAX_TEXT_FILE_SIZE / 1024 / 1024}MB limit`
      )
    }
    const buffer = await handle.readFile()
    if (buffer.byteLength > MAX_TEXT_FILE_SIZE) {
      throw new Error(
        `File too large: ${(buffer.byteLength / 1024 / 1024).toFixed(1)}MB exceeds ${MAX_TEXT_FILE_SIZE / 1024 / 1024}MB limit`
      )
    }
    if (isBinaryBuffer(buffer)) {
      return { content: '', isBinary: true }
    }
    return {
      content: buffer.toString('utf8'),
      isBinary: false,
      fileIdentity: localLogFileIdentity(stats)
    }
  } finally {
    await handle.close()
  }
}

type DownloadFileResult = { canceled: true } | { canceled: false; destinationPath: string }

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Pause the process writing to the file, then retry.
  2. Copy the file to a stable path and open the copy.
  3. Use a tail-based viewer that reads only the end of the file.

Example fix

// before: read /var/log/app.log while the app is appending
// after: snapshot the log and read the snapshot
//   cp /var/log/app.log /tmp/app-snapshot.log
//   open /tmp/app-snapshot.log with includeLocalLogMetadata
Defensive patterns

Strategy: retry

Try / catch

try {
  const result = await ipcRenderer.invoke('fs:readFile', { filePath, includeLocalLogMetadata: true })
} catch (error) {
  if (error instanceof Error && error.message.startsWith('File too large') && error.message.includes('exceeds')) {
    // file may have grown during read; snapshot and retry
    showUserWarning('The file grew during read. It will be snapshotted and reopened.')
    return
  }
  throw error
}

Prevention

When it happens

Trigger: A file whose stat.size was under 50 MB when checked, but grew past 50 MB by the time readFile completed. The buffer.byteLength check catches the post-read size and rejects it.

Common situations: Reading an actively growing log file. A process appending to the file between the stat check and the full read. A file being reconstructed or decompressed concurrently during the read.

Related errors


AI-assisted analysis of stablyai/orca@1136503c6a (2026-08-12). Data as JSON: /api/errors/f84d95d55b7666bb. Report an issue: GitHub.