{"record":{"id":"2e0dcf14b01fdf1a","repo":"danny-avila/LibreChat","slug":"parsed-error","errorCode":null,"errorMessage":"${parsed.error}","messagePattern":"\\$\\{parsed\\.error\\}","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"api/server/services/Files/Code/process.js","lineNumber":1296,"sourceCode":"      '    f.seek(offset)',\n      '    raw = f.read(chunk)',\n      'print(json.dumps({\"total\": st.st_size, \"n\": len(raw), \"b64\": base64.b64encode(raw).decode(\"ascii\")}))',\n      'PY',\n    ].join('\\n');\n\n    const parsed = await execSandboxImageChunk({\n      baseURL,\n      code,\n      file_path,\n      session_id,\n      runtime_session_hint,\n      files,\n      req,\n      chunkBytes,\n    });\n\n    if (parsed.error) {\n      throw new Error(String(parsed.error));\n    }\n    if (parsed.too_large === true) {\n      return { tooLarge: true, bytes: Number(parsed.bytes) || 0 };\n    }\n    if (typeof parsed.b64 !== 'string' || typeof parsed.n !== 'number') {\n      return null;\n    }\n\n    if (total == null) {\n      total = Number(parsed.total) || 0;\n      if (total > limit) {\n        return { tooLarge: true, bytes: total };\n      }\n    } else if (Number(parsed.total) !== total) {\n      /* The file changed underneath us; a spliced-together buffer would be\n       * a mix of two versions rather than any real image. */\n      throw new Error(`\"${file_path}\" changed while being read from the sandbox`);\n    }","sourceCodeStart":1278,"sourceCodeEnd":1314,"githubUrl":"https://github.com/danny-avila/LibreChat/blob/5ff282f9006c436e561de1afd39a481bea1ef0d8/api/server/services/Files/Code/process.js#L1278-L1314","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Inspect parsed.error — it is the sandbox reader's own diagnostic and names the precise cause.","Retry the full image read once; transient sandbox I/O errors often clear.","Confirm the file is fully uploaded (not mid-write) before reading.","If persistent, fall back to readSandboxFile (text) or report the image as unreadable."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  const img = await readSandboxImage({ file_path, session_id, req });\n} catch (err) {\n  // one retry for transient sandbox I/O\n  return readSandboxImage({ file_path, session_id, req });\n}","preventionTips":["Ensure the file is fully written before reading (no concurrent writer).","Inspect parsed.error for the sandbox reader's precise diagnostic.","Fall back to readSandboxFile (text) if the image read is persistently failing."],"tags":["code-env","sandbox","image","read","agents"],"backgroundTag":null,"analyzedSha":"5ff282f9006c436e561de1afd39a481bea1ef0d8","analyzedAt":"2026-08-12T21:38:08.145Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}