stablyai/orca · warning · Error

File too large: ${(stats.size / 1024 / 1024).toFixed(1)}MB e

Error message

File too large: ${(stats.size / 1024 / 1024).toFixed(1)}MB exceeds ${sizeLimit / 1024 / 1024}MB limit

What it means

Thrown by the fs:readFile IPC handler when a file exceeds its size limit. The limit is 50 MB for previewable binary types (images, PDFs) and 50 MB for all other files. The check uses stat on the file path before reading, so oversized files are rejected early to prevent memory exhaustion from buffering entire files into base64 or UTF-8 strings.

Source

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

      content: string
      isBinary: boolean
      isImage?: boolean
      mimeType?: string
      fileIdentity?: string
    }> => {
      if (args.connectionId) {
        const provider = requireSshFilesystemProvider(args.connectionId)
        return provider.readFile(args.filePath)
      }
      const filePath = await resolveAuthorizedPath(args.filePath, store)
      if (args.includeLocalLogMetadata === true) {
        return readLocalLogSnapshot(filePath)
      }
      const stats = await stat(filePath)
      const mimeType = PREVIEWABLE_BINARY_MIME_TYPES[extname(filePath).toLowerCase()]
      const sizeLimit = mimeType ? MAX_PREVIEWABLE_BINARY_SIZE : MAX_TEXT_FILE_SIZE
      if (stats.size > sizeLimit) {
        throw new Error(
          `File too large: ${(stats.size / 1024 / 1024).toFixed(1)}MB exceeds ${sizeLimit / 1024 / 1024}MB limit`
        )
      }

      if (mimeType) {
        const buffer = await readFile(filePath)
        return {
          content: buffer.toString('base64'),
          isBinary: true,
          // Why: the renderer keys previewable-binary rendering off `isImage`, so set it for PDFs too to stay compatible.
          isImage: true,
          mimeType
        }
      }

      // Why: probe large unknown files first so archives aren't fully buffered only to discover they aren't editable text.
      if (stats.size > BINARY_PROBE_BYTES && (await isBinaryFilePrefix(filePath))) {
        return { content: '', isBinary: true }

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Reduce the file size: compress images, split PDFs, or truncate data files.
  2. For images, downscale or convert to a more compact format.
  3. Open the file in an external application designed for large files instead of through the in-app viewer.

Example fix

// before: open a 60MB PDF via fs:readFile
// after: compress or split the PDF
//   gs -sDEVICE=pdfwrite -dPDFSETTINGS=/ebook -o compressed.pdf large.pdf
//   open compressed.pdf
Defensive patterns

Strategy: validation

Validate before calling

const { stat } = await import('node:fs/promises')
const { extname } = await import('node:path')

const MAX_TEXT_FILE_SIZE = 50 * 1024 * 1024
const MAX_PREVIEWABLE_BINARY_SIZE = 50 * 1024 * 1024
const PREVIEWABLE = ['.png', '.jpg', '.jpeg', '.gif', '.svg', '.webp', '.bmp', '.ico', '.pdf']

async function assertFileUnderReadLimit(filePath: string): Promise<void> {
  const s = await stat(filePath)
  const ext = extname(filePath).toLowerCase()
  const limit = PREVIEWABLE.includes(ext) ? MAX_PREVIEWABLE_BINARY_SIZE : MAX_TEXT_FILE_SIZE
  if (s.size > limit) {
    throw new Error(`${filePath} is ${(s.size / 1048576).toFixed(1)}MB, exceeds ${(limit / 1048576).toFixed(0)}MB read limit`)
  }
}

Try / catch

try {
  const result = await ipcRenderer.invoke('fs:readFile', { filePath })
} catch (error) {
  if (error instanceof Error && error.message.startsWith('File too large')) {
    showUserWarning(error.message + ' — reduce the file size or open in an external app.')
    return
  }
  throw error
}

Prevention

When it happens

Trigger: Calling fs:readFile (without includeLocalLogMetadata) on a local file whose stat.size exceeds the applicable limit. For previewable binaries (.png, .jpg, .jpeg, .gif, .svg, .webp, .bmp, .ico, .pdf) the limit is MAX_PREVIEWABLE_BINARY_SIZE (50 MB); for all other files it is MAX_TEXT_FILE_SIZE (50 MB).

Common situations: Opening a large image, PDF, video, or binary file in the file viewer. Reading a large source file, data export, or log through the general readFile path. Attempting to preview a high-resolution image or multi-page PDF.

Related errors


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