danny-avila/LibreChat · error

${parsed.error}

Error message

${parsed.error}

What it means

Thrown by the chunked image reader (Code/process.js) when execSandboxImageChunk returns a payload with parsed.error set — the in-sandbox Python reader reported an error reading the requested chunk. Distinct from a transport error: the sandbox responded, but the read itself failed.

Source

Thrown at api/server/services/Files/Code/process.js:1296

      '    f.seek(offset)',
      '    raw = f.read(chunk)',
      'print(json.dumps({"total": st.st_size, "n": len(raw), "b64": base64.b64encode(raw).decode("ascii")}))',
      'PY',
    ].join('\n');

    const parsed = await execSandboxImageChunk({
      baseURL,
      code,
      file_path,
      session_id,
      runtime_session_hint,
      files,
      req,
      chunkBytes,
    });

    if (parsed.error) {
      throw new Error(String(parsed.error));
    }
    if (parsed.too_large === true) {
      return { tooLarge: true, bytes: Number(parsed.bytes) || 0 };
    }
    if (typeof parsed.b64 !== 'string' || typeof parsed.n !== 'number') {
      return null;
    }

    if (total == null) {
      total = Number(parsed.total) || 0;
      if (total > limit) {
        return { tooLarge: true, bytes: total };
      }
    } else if (Number(parsed.total) !== total) {
      /* The file changed underneath us; a spliced-together buffer would be
       * a mix of two versions rather than any real image. */
      throw new Error(`"${file_path}" changed while being read from the sandbox`);
    }

View on GitHub (pinned to 5ff282f900)

Solutions

  1. Inspect parsed.error — it is the sandbox reader's own diagnostic and names the precise cause.
  2. Retry the full image read once; transient sandbox I/O errors often clear.
  3. Confirm the file is fully uploaded (not mid-write) before reading.
  4. If persistent, fall back to readSandboxFile (text) or report the image as unreadable.
Defensive patterns

Strategy: retry

Try / catch

try {
  const img = await readSandboxImage({ file_path, session_id, req });
} catch (err) {
  // one retry for transient sandbox I/O
  return readSandboxImage({ file_path, session_id, req });
}

Prevention

When it happens

Trigger: The base64-chunk reader script inside the sandbox returned `{ error: '...' }` for a given offset — e.g. file vanished mid-read, I/O error, permission denied on the specific chunk read.

Common situations: File deleted between the stat and the chunk read; sandbox filesystem hiccup; the path is a symlink to a missing target; partial upload left a truncated file.

Related errors


AI-assisted analysis of danny-avila/LibreChat@5ff282f900 (2026-08-12). Data as JSON: /api/errors/2e0dcf14b01fdf1a. Report an issue: GitHub.