-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
Description
What happened?
We are opening this issue as a follow-up to Discussion #11334. While a solution was suggested there, it has not resolved the problem in our production environment.
We are consistently encountering the Input is too long for requested model error when conversations become lengthy. This indicates that LibreChat is not correctly calculating the available context window to determine when to truncate or drop older messages/context.
It seems the current context management logic does not account for the combined overhead of:
- Thinking Budget: We reserve a large portion for reasoning.
- File Context & Search: We use multiple files attached directly to context.
- Artifacts: We generate React artifacts, which add significant token load to the history.
Instead of pruning the conversation history to fit within the model's limit, LibreChat attempts to send a payload that exceeds the Bedrock limit.
Previous Attempts
As suggested in Discussion #11334, we attempted to adjust standard parameters maxContextTokens, but the issue persists. The logic seems to fail, suggesting the token counting/subtraction logic might be off for this specific configuration.
Version Information
[LibreChat v0.8.2]
Steps to Reproduce
- Configure a Bedrock model (Claude family) with "Thinking" enabled.
- Attach approximately 10 small files using file_context and 8 using file_search.
- Enable a Clickhouse MCP.
- Start a conversation requesting React Artifact generation (heavy code output).
- Continue the conversation until the context fills up.
- Actual Result: The conversation crashes with "Input is too long" instead of dropping old messages.
- Expected Result: LibreChat should handle context truncation automatically, ensuring the prompt sent to Bedrock fits within the limit (Total Limit - Thinking Budget - Max Output - Safety Buffer).
Model & Configuration
Model: global.anthropic.claude-opus-4-5-20251101-v1:0
Max Output Tokens: 64000
Thinking Budget: 10000
Attachments:
file_context: ~10 files
file_search: ~8 files
Tools/MCP: Clickhouse MCP active.
What browsers are you seeing the problem on?
No response
Relevant log output
Something went wrong. Here's the specific error message we encountered: An error occurred while processing the request: The model returned the following errors: Input is too long for requested model.Screenshots
No response
Code of Conduct
- I agree to follow this project's Code of Conduct