Skip to content

fix: include character count and limit in 'Document is too long' error#184

Open
DanielFoster88 wants to merge 1 commit into
PAIR-code:mainfrom
DanielFoster88:fix/improve-document-too-long-error
Open

fix: include character count and limit in 'Document is too long' error#184
DanielFoster88 wants to merge 1 commit into
PAIR-code:mainfrom
DanielFoster88:fix/improve-document-too-long-error

Conversation

@DanielFoster88
Copy link
Copy Markdown

Problem

When a paper's LaTeX source exceeds MAX_LATEX_CHARACTER_COUNT (300,000 characters), the import pipeline raises:

ValueError: Document is too long

This gives users zero context — they don't know how long their document is, what the limit is, or what they can do about it (see #130).

Fix

The error message now includes:

  • Actual character count of the document
  • Configured limit (300,000)
  • Actionable suggestion to use a shorter version or split into sections

Before

ValueError: Document is too long

After

ValueError: Document is too long: 487,234 characters (limit is 300,000).
Consider using a shorter version of the paper or splitting it into sections.

Related Issues

Fixes #130

When a paper's LaTeX source exceeds MAX_LATEX_CHARACTER_COUNT (300,000),
the error message was just 'Document is too long' with no context.

Now it includes:
- The actual character count of the document
- The configured limit
- A suggestion to use a shorter version or split into sections

This helps users understand why their paper was rejected and what
they can do about it.

Fixes PAIR-code#130
@google-cla
Copy link
Copy Markdown

google-cla Bot commented May 16, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

【Error】Raise ValueError(f"Document is too long") ValueError: Document is too long

1 participant