Azure DALL-e failing on v1.0.1 - 'base64' is not defined #81

Closed
opened 2026-02-16 10:18:00 -05:00 by yindo · 5 comments
Owner

Originally created by @jonjonhui on GitHub (Mar 14, 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

1.0.1

Cloud or Self Hosted

Cloud, Self Hosted (Docker)

Steps to reproduce

  1. Create an agent
  2. Attach Azure DALL-e as a tool
  3. Send a message to request for an image

✔️ Expected Behavior

Azure Dall-E successfully returns an image

Actual Behavior

Image
This error is thrown.
{"azure_dalle3": "tool invoke error: PluginInvokeError: {"args":{},"error_type":"NameError","message":"name 'base64' is not defined"}"}

Originally created by @jonjonhui on GitHub (Mar 14, 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 1.0.1 ### Cloud or Self Hosted Cloud, Self Hosted (Docker) ### Steps to reproduce 1. Create an agent 2. Attach Azure DALL-e as a tool 3. Send a message to request for an image ### ✔️ Expected Behavior Azure Dall-E successfully returns an image ### ❌ Actual Behavior ![Image](https://github.com/user-attachments/assets/05302b40-d576-4d1b-826b-a63a1679daa0) This error is thrown. {"azure_dalle3": "tool invoke error: PluginInvokeError: {\"args\":{},\"error_type\":\"NameError\",\"message\":\"name 'base64' is not defined\"}"}
yindo added the good first issue label 2026-02-16 10:18:00 -05:00
yindo closed this issue 2026-02-16 10:18:00 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Mar 14, 2025):

@jonjonhui Hello! I'm here to help you with bugs, questions, and becoming a contributor. Let me know how I can assist you while you wait for a human maintainer.

The error you're encountering, "name 'base64' is not defined," suggests that the base64 module is not being imported in the context where it's needed for the Azure DALL-e integration. In the Dify codebase, the base64 module is typically imported using the following statement:

from base64 import b64decode

This import is necessary for decoding base64-encoded image data received from the DALL-e API [1][2].

To resolve this issue, ensure that the base64 module is correctly imported in the file where the Azure DALL-e tool is implemented. You should check the relevant file for the DallE3Tool class and verify that the import statement is present and correctly placed at the top of the file. If it's missing, add the import statement to fix the NameError.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

@dosubot[bot] commented on GitHub (Mar 14, 2025): <!-- Greeting --> @jonjonhui Hello! I'm here to help you with bugs, questions, and becoming a contributor. Let me know how I can assist you while you wait for a human maintainer. <!-- Answer --> The error you're encountering, "name 'base64' is not defined," suggests that the `base64` module is not being imported in the context where it's needed for the Azure DALL-e integration. In the Dify codebase, the `base64` module is typically imported using the following statement: ```python from base64 import b64decode ``` This import is necessary for decoding base64-encoded image data received from the DALL-e API <sup>[[1]](https://github.com/langgenius/dify-docs/blob/main/en/guides/tools/advanced-tool-integration.md)</sup><sup>[[2]](https://github.com/langgenius/dify-docs/blob/main/jp/guides/tools/advanced-tool-integration.md)</sup>. To resolve this issue, ensure that the `base64` module is correctly imported in the file where the Azure DALL-e tool is implemented. You should check the relevant file for the `DallE3Tool` class and verify that the import statement is present and correctly placed at the top of the file. If it's missing, add the import statement to fix the `NameError`. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/6bcc2ee9-09e1-4c95-8c73-97df0cac2c3b?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/6bcc2ee9-09e1-4c95-8c73-97df0cac2c3b?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/6bcc2ee9-09e1-4c95-8c73-97df0cac2c3b?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/6bcc2ee9-09e1-4c95-8c73-97df0cac2c3b?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/6bcc2ee9-09e1-4c95-8c73-97df0cac2c3b?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/6bcc2ee9-09e1-4c95-8c73-97df0cac2c3b?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/6bcc2ee9-09e1-4c95-8c73-97df0cac2c3b?feedback_type=other)</sup>
Author
Owner

@crazywoola commented on GitHub (Mar 16, 2025):

I can not reproduce this error.

Image

Can you try to reinstall it again?

@crazywoola commented on GitHub (Mar 16, 2025): I can not reproduce this error. ![Image](https://github.com/user-attachments/assets/f665ae7b-93ca-457a-9106-2efa7035c2a9) Can you try to reinstall it again?
Author
Owner

@skimhiro commented on GitHub (Mar 16, 2025):

An issue with attachment is occurring with Azure Dalle-E.

Image

Image

DallE import

import base64
import random

Azure DallE import

import random
from base64 import b64decode
@skimhiro commented on GitHub (Mar 16, 2025): An issue with attachment is occurring with Azure Dalle-E. ![Image](https://github.com/user-attachments/assets/6e834586-a935-4d19-bede-9272e6553d26) ![Image](https://github.com/user-attachments/assets/49c62405-b4f8-40a5-b36d-1efa36526919) DallE import ``` import base64 import random ``` Azure DallE import ``` import random from base64 import b64decode ```
Author
Owner

@jonjonhui commented on GitHub (Mar 16, 2025):

I can not reproduce this error.

Image

Can you try to reinstall it again?

My issue is with Azure Dall-E not Dall-E

@jonjonhui commented on GitHub (Mar 16, 2025): > I can not reproduce this error. > > ![Image](https://github.com/user-attachments/assets/f665ae7b-93ca-457a-9106-2efa7035c2a9) > > Can you try to reinstall it again? My issue is with Azure Dall-E not Dall-E
Author
Owner

@skimhiro commented on GitHub (Mar 17, 2025):

I was able to confirm that it worked by changing the import statements.

tools/azuredalle/tools/dalle3.py

from base64 import b64decode --> import base64

@skimhiro commented on GitHub (Mar 17, 2025): I was able to confirm that it worked by changing the import statements. tools/azuredalle/tools/dalle3.py from base64 import b64decode --> import base64
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify-official-plugins#81