failed to read response body: bufio.Scanner: token too long #324

Closed
opened 2026-02-16 10:19:00 -05:00 by yindo · 3 comments
Owner

Originally created by @TaylorSwift5201314 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 search for existing issues, 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

V1.4.1

Cloud or Self Hosted

Cloud

Steps to reproduce

I don't encounter this issue with GPT-4.1, but when using Doubao-1.5-vision-pro, if the image size exceeds 3MB, it directly prompts: "failed to read response body: bufio.Scanner: token too long".

Image
Image

✔️ Expected Behavior

No response

Actual Behavior

No response

Originally created by @TaylorSwift5201314 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 [search for existing issues](https://github.com/langgenius/dify/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 V1.4.1 ### Cloud or Self Hosted Cloud ### Steps to reproduce I don't encounter this issue with GPT-4.1, but when using Doubao-1.5-vision-pro, if the image size exceeds 3MB, it directly prompts: "failed to read response body: bufio.Scanner: token too long". ![Image](https://github.com/user-attachments/assets/06e2e6d3-4c7a-4d73-92f7-0976b1ec07ac) ![Image](https://github.com/user-attachments/assets/8eb9c1e8-c706-4412-be2d-daaaed6eea95) ### ✔️ Expected Behavior _No response_ ### ❌ Actual Behavior _No response_
yindo closed this issue 2026-02-16 10:19:00 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (May 29, 2025):

The "failed to read response body: bufio.Scanner: token too long" error when using Doubao-1.5-vision-pro with images larger than 3MB is a known issue. This error typically occurs because the Go bufio.Scanner has a buffer size limit, and large images—especially when base64 encoded—can exceed this limit.

A similar issue was previously resolved by upgrading to Dify version 1.4.0 or later, so your current version (1.4.1) should already include that fix for the Volcengine plugin and Doubao-1.5-vision-pro model. However, if you are using the openai_api_compatible provider, the error can still occur with large images due to the way images are encoded and sent to the backend. In this case, reducing the image size before uploading or switching to a different model provider can help avoid the error. More details can be found in these related issues:

If you continue to encounter this error after reducing image size or changing providers, please provide additional details about your setup or the specific provider configuration.

To reply, just mention my name @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Join Discord Share on X

@dosubot[bot] commented on GitHub (May 29, 2025): <!-- Answer --> The "failed to read response body: bufio.Scanner: token too long" error when using Doubao-1.5-vision-pro with images larger than 3MB is a known issue. This error typically occurs because the Go bufio.Scanner has a buffer size limit, and large images—especially when base64 encoded—can exceed this limit. A similar issue was previously resolved by upgrading to Dify version 1.4.0 or later, so your current version (1.4.1) should already include that fix for the Volcengine plugin and Doubao-1.5-vision-pro model. However, if you are using the openai_api_compatible provider, the error can still occur with large images due to the way images are encoded and sent to the backend. In this case, reducing the image size before uploading or switching to a different model provider can help avoid the error. More details can be found in these related issues: - ["token too long" error resolved by upgrading Dify](https://github.com/langgenius/dify-official-plugins/issues/1226) - [Error with large images and openai_api_compatible provider](https://github.com/langgenius/dify/issues/18657) If you continue to encounter this error after reducing image size or changing providers, please provide additional details about your setup or the specific provider configuration. <!-- Dosu Comment Footer --> *To reply, just mention my name [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/fa2375da-5ef2-474b-9f25-d3a3d3880969?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/fa2375da-5ef2-474b-9f25-d3a3d3880969?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/fa2375da-5ef2-474b-9f25-d3a3d3880969?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/fa2375da-5ef2-474b-9f25-d3a3d3880969?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/fa2375da-5ef2-474b-9f25-d3a3d3880969?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/fa2375da-5ef2-474b-9f25-d3a3d3880969?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/fa2375da-5ef2-474b-9f25-d3a3d3880969?feedback_type=other)</sup>&nbsp;&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify/issues/20439)
Author
Owner

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

Such problems occurred when using the online version V1.4.1

@TaylorSwift5201314 commented on GitHub (May 29, 2025): Such problems occurred when using the online version V1.4.1
Author
Owner

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

GPT-4.1:Normal
Doubao-1.5-vision-pro:failed to read response body: bufio.Scanner: token too long

@TaylorSwift5201314 commented on GitHub (May 29, 2025): GPT-4.1:Normal Doubao-1.5-vision-pro:failed to read response body: bufio.Scanner: token too long
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify-official-plugins#324