bedrock claude LLM plugin report error when upload a file as input #931

Open
opened 2026-02-16 10:21:02 -05:00 by yindo · 3 comments
Owner

Originally created by @nadazero on GitHub (Jan 14, 2026).

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.10.1-fix1

Plugin version

0.0.58

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Image

and I upload the reproduce task yml file, you can run it and reproduce the issue.

测试claude模型上传附件bug.yml

✔️ Error log

No response

Originally created by @nadazero on GitHub (Jan 14, 2026). ### 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.10.1-fix1 ### Plugin version 0.0.58 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce ![Image](https://github.com/user-attachments/assets/c3fd3bd0-4a8d-42c7-9b9b-6d3abf65f642) and I upload the reproduce task yml file, you can run it and reproduce the issue. [测试claude模型上传附件bug.yml](https://github.com/user-attachments/files/24606910/claude.bug.yml) ### ✔️ Error log _No response_
yindo added the bug label 2026-02-16 10:21:02 -05:00
Author
Owner

@nadazero commented on GitHub (Jan 14, 2026):

The problem seems to be treating the upload file as a string for "strip" processing

@nadazero commented on GitHub (Jan 14, 2026): The problem seems to be treating the upload file as a string for "strip" processing
Author
Owner

@dosubot[bot] commented on GitHub (Jan 14, 2026):

You're right—the error happens because the plugin tries to call .strip() on the uploaded file input, which is actually a list (not a string) when passed via the Jinja template. The Bedrock Claude plugin expects system message content to be a string, but when a file is uploaded, it arrives as a list of content objects. Without type checking, calling .strip() on a list throws the 'list' object has no attribute 'strip' error reference.

To fix this, the plugin code should check if message.content is a list before calling .strip(). For example:

if isinstance(message.content, str):
    message.content = message.content.strip()
elif isinstance(message.content, list):
    # Optionally, join text parts or extract the relevant file content
    message.content = " ".join(
        str(part.get("text", "")) for part in message.content if isinstance(part, dict)
    )
    message.content = message.content.strip()

As a workaround, you can also adjust your workflow or Jinja template to extract the file content as a string before passing it to the system prompt, so the plugin receives a string and not a list.

This pattern—checking for lists and extracting the first file or joining text—is used in other plugins to handle uploads safely reference. Making this change will prevent the error and allow file uploads to work as expected.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

Open in Cursor Join Discord Share on X

@dosubot[bot] commented on GitHub (Jan 14, 2026): <!-- Answer --> You're right—the error happens because the plugin tries to call `.strip()` on the uploaded file input, which is actually a list (not a string) when passed via the Jinja template. The Bedrock Claude plugin expects system message content to be a string, but when a file is uploaded, it arrives as a list of content objects. Without type checking, calling `.strip()` on a list throws the `'list' object has no attribute 'strip'` error [reference](https://github.com/langgenius/dify-official-plugins/blob/0e1043af9b73cb9040f82f2b1a58e910a2593697/models/bedrock/models/llm/llm.py#L761-L893). To fix this, the plugin code should check if `message.content` is a list before calling `.strip()`. For example: ```python if isinstance(message.content, str): message.content = message.content.strip() elif isinstance(message.content, list): # Optionally, join text parts or extract the relevant file content message.content = " ".join( str(part.get("text", "")) for part in message.content if isinstance(part, dict) ) message.content = message.content.strip() ``` As a workaround, you can also adjust your workflow or Jinja template to extract the file content as a string before passing it to the system prompt, so the plugin receives a string and not a list. This pattern—checking for lists and extracting the first file or joining text—is used in other plugins to handle uploads safely [reference](https://github.com/langgenius/dify-official-plugins/pull/2205). Making this change will prevent the error and allow file uploads to work as expected. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/1ad5db58-0fbe-45fb-a797-92c337750d6e?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/1ad5db58-0fbe-45fb-a797-92c337750d6e?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/1ad5db58-0fbe-45fb-a797-92c337750d6e?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/1ad5db58-0fbe-45fb-a797-92c337750d6e?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/1ad5db58-0fbe-45fb-a797-92c337750d6e?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/1ad5db58-0fbe-45fb-a797-92c337750d6e?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/1ad5db58-0fbe-45fb-a797-92c337750d6e?feedback_type=other)</sup> [![Open in Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=You%27re%20right%E2%80%94the%20error%20happens%20because%20the%20plugin%20tries%20to%20call%20%60.strip%28%29%60%20on%20the%20uploaded%20file%20input%2C%20which%20is%20actually%20a%20list%20%28not%20a%20string%29%20when%20passed%20via%20the%20Jinja%20template.%20The%20Bedrock%20Claude%20plugin%20expects%20system%20message%20content%20to%20be%20a%20string%2C%20but%20when%20a%20file%20is%20uploaded%2C%20it%20arrives%20as%20a%20list%20of%20content%20objects.%20Without%20type%20checking%2C%20calling%20%60.strip%28%29%60%20on%20a%20list%20throws%20the%20%60%27list%27%20object%20has%20no%20attribute%20%27strip%27%60%20error%C2%A0%5Breference%5D%28https%3A//github.com/langgenius/dify-official-plugins/blob/0e1043af9b73cb9040f82f2b1a58e910a2593697/models/bedrock/models/llm/llm.py%23L761-L893%29.%0A%0ATo%20fix%20this%2C%20the%20plugin%20code%20should%20check%20if%20%60message.content%60%20is%20a%20list%20before%20calling%20%60.strip%28%29%60.%20For%20example%3A%0A%0A%60%60%60python%0Aif%20isinstance%28message.content%2C%20str%29%3A%0A%20%20%20%20message.content%20%3D%20message.content.strip%28%29%0Aelif%20isinstance%28message.content%2C%20list%29%3A%0A%20%20%20%20%23%20Optionally%2C%20join%20text%20parts%20or%20extract%20the%20relevant%20file%20content%0A%20%20%20%20message.content%20%3D%20%22%20%22.join%28%0A%20%20%20%20%20%20%20%20str%28part.get%28%22text%22%2C%20%22%22%29%29%20for%20part%20in%20message.content%20if%20isinstance%28part%2C%20dict%29%0A%20%20%20%20%29%0A%20%20%20%20message.content%20%3D%20message.content.strip%28%29%0A%60%60%60%0A%0AAs%20a%20workaround%2C%20you%20can%20also%20adjust%20your%20workflow%20or%20Jinja%20template%20to%20extract%20the%20file%20content%20as%20a%20string%20before%20passing%20it%20to%20the%20system%20prompt%2C%20so%20the%20plugin%20receives%20a%20string%20and%20not%20a%20list.%0A%0AThis%20pattern%E2%80%94checking%20for%20lists%20and%20extracting%20the%20first%20file%20or%20joining%20text%E2%80%94is%20used%20in%20other%20plugins%20to%20handle%20uploads%20safely%C2%A0%5Breference%5D%28https%3A//github.com/langgenius/dify-official-plugins/pull/2205%29.%20Making%20this%20change%20will%20prevent%20the%20error%20and%20allow%20file%20uploads%20to%20work%20as%20expected.)&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-official-plugins/issues/2417)
Author
Owner

@crazywoola commented on GitHub (Feb 3, 2026):

Hi @nadazero, thanks for opening this issue.

Why this is being closed

Dify issue tracking requires English-only issue title and description for consistent collaboration.

Next steps

Please open a new issue in English and include clear details so maintainers can help efficiently.

Thanks for understanding and for your support.

@crazywoola commented on GitHub (Feb 3, 2026): Hi @nadazero, thanks for opening this issue. ### Why this is being closed Dify issue tracking requires English-only issue title and description for consistent collaboration. ### Next steps Please open a new issue in English and include clear details so maintainers can help efficiently. Thanks for understanding and for your support.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify-official-plugins#931