Skip to content

renderer: Fix miselading error message#33430

Closed
RishabhSaini wants to merge 1 commit intovllm-project:mainfrom
RishabhSaini:rendererErrMsg
Closed

renderer: Fix miselading error message#33430
RishabhSaini wants to merge 1 commit intovllm-project:mainfrom
RishabhSaini:rendererErrMsg

Conversation

@RishabhSaini
Copy link
Copy Markdown
Contributor

@RishabhSaini RishabhSaini commented Jan 30, 2026

Fixes: #33418

Maximum allow total input length
RendererConfig.max_length = max_model_len - (max_output_tokens + truncated_input_length)

Signed-off-by: RishabhSaini <rishabhsaini01@gmail.com>
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request aims to fix a misleading error message. While the new message is more informative, it introduces a formatting error by omitting spaces between concatenated string literals. This would result in an unreadable error message for the user. I have provided a suggestion to correct this formatting issue.

Comment on lines +399 to +403
f"The token count of your prompt ({len(token_ids)})"
f"plus request's max_tokens cannot exceed the"
f"model's context length of {self.model_config.max_model_len}. "
f"Maximum allowed input is {max_length} tokens. "
"Please reduce the input length or decrease max_tokens.",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The new error message is much more informative, but it has a formatting issue. The separate f-strings on lines 399 and 400 will be concatenated without a space, resulting in a malformed message containing ...prompt (X)plus... and ...exceed themodel's.... To ensure the message is readable, spaces should be added at the end of these lines.

Suggested change
f"The token count of your prompt ({len(token_ids)})"
f"plus request's max_tokens cannot exceed the"
f"model's context length of {self.model_config.max_model_len}. "
f"Maximum allowed input is {max_length} tokens. "
"Please reduce the input length or decrease max_tokens.",
f"The token count of your prompt ({len(token_ids)}) "
f"plus request's max_tokens cannot exceed the "
f"model's context length of {self.model_config.max_model_len}. "
f"Maximum allowed input is {max_length} tokens. "
"Please reduce the input length or decrease max_tokens.",

@RishabhSaini
Copy link
Copy Markdown
Contributor Author

Closing in preference of #33425

@RishabhSaini RishabhSaini deleted the rendererErrMsg branch January 30, 2026 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: wrong error reported when len(prompt) + requested tokens > max_context_len

1 participant