stablyai/orca · warning · Error

File is too large (${(srcStat.size / (1024 * 1024)).toFixed(

Error message

File is too large (${(srcStat.size / (1024 * 1024)).toFixed(1)} MB). Max is ${MAX_BYTES / (1024 * 1024)} MB.

What it means

Thrown by the pet:import handler when srcStat.size exceeds MAX_BYTES (64 MiB, defined as 64 * 1024 * 1024). The cap exists so a renderer building a Blob URL from the bytes cannot be OOM'd by a multi-gigabyte file. The message includes the actual size and the cap in MB so the user knows how much to shrink.

Source

Thrown at src/main/ipc/pet.ts:205

    if (result.canceled || result.filePaths.length === 0) {
      return null
    }
    const src = result.filePaths[0]
    const classified = classifyFile(src)
    if (!classified) {
      throw new Error('Unsupported file. Pick a PNG, APNG, JPG, GIF, WebP, or SVG.')
    }
    let srcStat: Awaited<ReturnType<typeof stat>>
    try {
      srcStat = await stat(src)
    } catch {
      throw new Error('Could not read the selected file.')
    }
    if (!srcStat.isFile()) {
      throw new Error('Selected path is not a file')
    }
    if (srcStat.size > MAX_BYTES) {
      throw new Error(
        `File is too large (${(srcStat.size / (1024 * 1024)).toFixed(1)} MB). Max is ${MAX_BYTES / (1024 * 1024)} MB.`
      )
    }

    const dir = getPetsDir()
    await mkdir(dir, { recursive: true })
    const id = randomUUID()
    // Why: keep the original extension in the on-disk name so pet:read can rebuild the Blob MIME without a separate lookup.
    const fileName = `${id}${classified.ext}`
    const dest = join(dir, fileName)
    try {
      await copyFile(src, dest)
    } catch {
      await rm(dest, { force: true }).catch(() => {})
      throw new Error('Could not save the pet.')
    }

    const rawLabel = basename(src, extname(src)).trim()

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Resize or compress the image to under 64 MiB before importing.
  2. For animated GIFs, reduce frame count or dimensions.
  3. For SVGs, remove embedded base64 raster data and reference external assets instead.
  4. If a legitimate pet needs more than 64 MiB, that exceeds the supported format — split it or simplify.
Defensive patterns

Strategy: validation

Validate before calling

import { stat } from 'node:fs/promises'
const MAX_BYTES = 64 * 1024 * 1024

const size = (await stat(pickedPath)).size
if (size > MAX_BYTES) {
  notify(`File is ${(size / 1048576).toFixed(1)} MB. Max is 64 MB.`)
  return
}

Try / catch

try {
  await ipcRenderer.invoke('pet:import')
} catch (e) {
  if (e instanceof Error && e.message.startsWith('File is too large')) {
    notify(e.message)
  } else throw e
}

Prevention

When it happens

Trigger: Selecting an image file larger than 64 MiB — high-resolution photos, uncompressed TIFFs renamed to .png, very large animated GIFs, or oversized SVGs with embedded base64 payloads.

Common situations: User picked a raw camera export, a print-resolution TIFF renamed to a permitted extension, or an animated GIF exported at too high a resolution.

Related errors


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