jackwener/OpenCLI · error · CliError
FILE_TOO_LARGE
FILE_TOO_LARGE
Error message
The PDF is larger than paperreview.ai's 10MB limit.
What it means
readPdfFile() enforces MAX_PDF_BYTES (10 * 1024 * 1024 = 10MB). If the file's size exceeds 10MB it throws FILE_TOO_LARGE before uploading, because paperreview.ai will not accept PDFs beyond its 10MB limit.
Source
Thrown at clis/paperreview/utils.js:76
}
let fileStat;
try {
fileStat = await fs.stat(resolvedPath);
}
catch (error) {
if (error?.code === 'ENOENT') {
throw new CliError('FILE_NOT_FOUND', `File not found: ${resolvedPath}`, 'Provide a valid PDF file path');
}
throw new CliError('FILE_READ_ERROR', `Unable to inspect file: ${resolvedPath}`, 'Check file permissions and try again');
}
if (!fileStat.isFile()) {
throw new CliError('FILE_NOT_FOUND', `Not a file: ${resolvedPath}`, 'Provide a valid PDF file path');
}
if (fileStat.size < 100) {
throw new CliError('ARGUMENT', 'The PDF is too small. paperreview.ai requires at least 100 bytes.', 'Provide the final paper PDF');
}
if (fileStat.size > MAX_PDF_BYTES) {
throw new CliError('FILE_TOO_LARGE', 'The PDF is larger than paperreview.ai\'s 10MB limit.', 'Compress the PDF or submit a smaller file');
}
let buffer;
try {
buffer = await fs.readFile(resolvedPath);
}
catch {
throw new CliError('FILE_READ_ERROR', `Unable to read file: ${resolvedPath}`, 'Check file permissions and try again');
}
return {
buffer,
fileName,
resolvedPath,
sizeBytes: buffer.byteLength,
};
}
export async function requestJson(pathname, init = {}) {
let response;
try {View on GitHub (pinned to 49907e53dc)
Solutions
- Compress the PDF (e.g. Ghostscript: gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook -o out.pdf in.pdf)
- Downsample or recompress figures to JPEG at reasonable DPI before rebuilding
- Remove embedded attachments/animations or unused fonts from the LaTeX build
- Split or reduce supplementary material and submit only the main paper
Example fix
// before
await readPdfFile('./paper-30mb.pdf');
// after
// $ gs -sDEVICE=pdfwrite -dPDFSETTINGS=/ebook -o paper-small.pdf paper-30mb.pdf
await readPdfFile('./paper-small.pdf'); // under 10MB Defensive patterns
Strategy: validation
Validate before calling
import fs from 'node:fs';
const MAX_PDF_BYTES = 10 * 1024 * 1024;
function assertPdfSize(p) {
const size = fs.statSync(p).size;
if (size > MAX_PDF_BYTES) throw new Error(`${p} is ${(size / 1048576).toFixed(1)}MB; compress below 10MB first`);
return size;
} Type guard
function isWithinUploadLimit(p) {
try { return fs.statSync(p).size <= 10 * 1024 * 1024; } catch { return false; }
} Try / catch
try {
const pdf = await readPdfFile(userPath);
} catch (e) {
if (e?.code === 'FILE_TOO_LARGE') {
console.error('Compress first: gs -sDEVICE=pdfwrite -dPDFSETTINGS=/ebook -o small.pdf ' + userPath);
} else throw e;
} Prevention
- Check `du -h paper.pdf` before submitting; keep under 10MB
- Standardize on Ghostscript compression for camera-ready PDFs
- Downsample figures to ~300dpi JPEG before LaTeX builds
- Strip embedded attachments and supplementary material from the main PDF
When it happens
Trigger: Calling readPdfFile() on a PDF whose fileStat.size > 10485760 bytes — e.g. papers with high-resolution figures, embedded fonts, or scans saved without compression.
Common situations: Camera-ready PDFs with 300dpi+ embedded images; LaTeX builds including full vector datasets; scanned manuscripts; arXiv source downloads with large supplementary figures.
Related errors
- archive search limit must be <= 100
- coingecko derivatives limit must be <= 500
- limit must be an integer between 1 and 15 (dianping single p
- limit must be an integer between 1 and ${max}
- eastmoney convertible --limit must be an integer between 1 a
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/ca80622ef0c901b0.
Report an issue: GitHub.