bedrock plugin on stdout: bufio.Scanner: token too long #319

Closed
opened 2026-02-16 10:18:59 -05:00 by yindo · 1 comment
Owner

Originally created by @dimsky on GitHub (May 29, 2025).

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues Dify issues & Dify Official Plugins, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1.4.0

Plugin version

all

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

When transmitting multiple images or other binary data to large language models, the print statements in plugins like Bedrock will output the base64 data from the prompt to stdio, which can cause plugin crashes. Please remove print statements before publishing plugins.

Issue Details
When print statements output large amounts of base64-encoded data to standard output, it can lead to:

Buffer overflow
Excessive memory usage
Plugin response timeouts
System resource exhaustion

Image

Image

https://github.com/langgenius/dify-official-plugins/blob/2e7f132cabfd32cd71e373d910ab429157ce6f96/models/bedrock/models/llm/llm.py#L648

✔️ Error log

No response

Originally created by @dimsky on GitHub (May 29, 2025). ### Self Checks - [x] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [x] I have searched for existing issues [Dify issues](https://github.com/langgenius/dify/issues) & [Dify Official Plugins](https://github.com/langgenius/dify-official-plugins/issues), including closed ones. - [x] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [x] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 1.4.0 ### Plugin version all ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce When transmitting multiple images or other binary data to large language models, the print statements in plugins like Bedrock will output the base64 data from the prompt to stdio, which can cause plugin crashes. Please remove print statements before publishing plugins. Issue Details When print statements output large amounts of base64-encoded data to standard output, it can lead to: Buffer overflow Excessive memory usage Plugin response timeouts System resource exhaustion ![Image](https://github.com/user-attachments/assets/6d77ab36-d3c3-4924-a6d6-a43908a4da5c) ![Image](https://github.com/user-attachments/assets/3744c692-e5b3-404c-a7f7-0f1782822406) https://github.com/langgenius/dify-official-plugins/blob/2e7f132cabfd32cd71e373d910ab429157ce6f96/models/bedrock/models/llm/llm.py#L648 ### ✔️ Error log _No response_
yindo added the bug label 2026-02-16 10:18:59 -05:00
yindo closed this issue 2026-02-16 10:18:59 -05:00
Author
Owner

@dimsky commented on GitHub (May 29, 2025):

If data must be displayed, only show the first few characters:

# Safe debugging approach
print(f"Base64 preview: {base64_data[:50]}...")
@dimsky commented on GitHub (May 29, 2025): If data must be displayed, only show the first few characters: ```python # Safe debugging approach print(f"Base64 preview: {base64_data[:50]}...") ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify-official-plugins#319