Workflow code node execution jieba method exception #18541

Closed
opened 2026-02-21 19:48:55 -05:00 by yindo · 0 comments
Owner

Originally created by @wsdGithub on GitHub (Sep 29, 2025).

Self Checks

  • I have read the Contributing Guide and Language Policy.
  • 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, otherwise it will be closed.
  • 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1.1.3

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

I use dify workflow to create a code node to execute the method containing jieba. The detailed code is as follows:

def main(user_input):
import re
import jieba

1. 文本清洗

text = user_input.strip()
text = re.sub(r'[^\w\s\u4e00-\u9fa5]', '', text)  # 保留中文、英文、数字

# 2. 敏感词过滤(示例列表,实际需要更完整)
sensitive_words = ["诈骗", "违禁品", "非法"]
for word in sensitive_words:
    text = text.replace(word, "***")

# 3. 分词处理(用于后续分析)
words = jieba.lcut(text)

return {
    "cleaned_text": text,
    "word_list": words,
    "text_length": len(text)
}

✔️ Expected Behavior

I installed the jieba package in the sandbox and created three folders:/tmp,/usr/tmp, and/var/tmp. There are also three directories mounted on the host machine, and the allowed_styscalls restriction has been relaxed as much as possible in the dify \ locker \ volumes \ sandbox \ conf \ sandbox \ config.yaml configuration file. I think the code can execute smoothly and return results.

Actual Behavior

After execution, the following error occurred. Please help me solve this problem in order to successfully execute the jieba method.
Building prefix dict from the default dictionary ... 15, in gettempdir return _os.fsdecode(_gettempdir()) File "/usr/local/lib/python3.10/tempfile.py", line 308, in gettempdir tempdir = get_default_tempdir() File "/usr/local/lib/python3.10/tempfile.py", line 223, in get_default_tempdir raise FileNotFoundError(errno.ENOENT, FileNotFoundError: [Errno 2] No usable temporary directory found in ['/tmp', '/var/tmp', '/usr/tmp', '/'] init_.py", line 325, in cut for word in cut_block(blk): File "/usr/local/lib/python3.10/site-packages/jieba/__init_.py", line 250, in __cut_DAG DAG = self.get_DAG(sentence) File "/usr/local/lib/python3.10/site-packages/jieba/__init_.py", line 181, in get_DAG self.check_initialized() File "/usr/local/lib/python3.10/site-packages/jieba/__init_.py", line 170, in check_initialized self.initialize() File "/usr/local/lib/python3.10/site-packages/jieba/__init_.py", line 125, in initialize self.tmp_dir or tempfile.gettempdir(), cache_file) File "/usr/local/lib/python3.10/tempfile.py", line 315, in gettempdir return _os.fsdecode(_gettempdir()) File "/usr/local/lib/python3.10/tempfile.py", line 308, in _gettempdir tempdir = _get_default_tempdir() File "/usr/local/lib/python3.10/tempfile.py", line 223, in _get_default_tempdir raise FileNotFoundError(_errno.ENOENT, FileNotFoundError: [Errno 2] No usable temporary directory found in ['/tmp', '/var/tmp', '/usr/tmp', '/'] error: exit status 255

Originally created by @wsdGithub on GitHub (Sep 29, 2025). ### Self Checks - [x] I have read the [Contributing Guide](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) and [Language Policy](https://github.com/langgenius/dify/issues/1542). - [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, otherwise it will be closed. - [x] 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 1.1.3 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce I use dify workflow to create a code node to execute the method containing jieba. The detailed code is as follows: def main(user_input): import re import jieba # 1. 文本清洗 text = user_input.strip() text = re.sub(r'[^\w\s\u4e00-\u9fa5]', '', text) # 保留中文、英文、数字 # 2. 敏感词过滤(示例列表,实际需要更完整) sensitive_words = ["诈骗", "违禁品", "非法"] for word in sensitive_words: text = text.replace(word, "***") # 3. 分词处理(用于后续分析) words = jieba.lcut(text) return { "cleaned_text": text, "word_list": words, "text_length": len(text) } ### ✔️ Expected Behavior I installed the jieba package in the sandbox and created three folders:/tmp,/usr/tmp, and/var/tmp. There are also three directories mounted on the host machine, and the allowed_styscalls restriction has been relaxed as much as possible in the dify \ locker \ volumes \ sandbox \ conf \ sandbox \ config.yaml configuration file. I think the code can execute smoothly and return results. ### ❌ Actual Behavior After execution, the following error occurred. Please help me solve this problem in order to successfully execute the jieba method. Building prefix dict from the default dictionary ... 15, in gettempdir return _os.fsdecode(_gettempdir()) File "/usr/local/lib/python3.10/tempfile.py", line 308, in _gettempdir tempdir = _get_default_tempdir() File "/usr/local/lib/python3.10/tempfile.py", line 223, in _get_default_tempdir raise FileNotFoundError(_errno.ENOENT, FileNotFoundError: [Errno 2] No usable temporary directory found in ['/tmp', '/var/tmp', '/usr/tmp', '/'] _init__.py", line 325, in cut for word in cut_block(blk): File "/usr/local/lib/python3.10/site-packages/jieba/__init__.py", line 250, in __cut_DAG DAG = self.get_DAG(sentence) File "/usr/local/lib/python3.10/site-packages/jieba/__init__.py", line 181, in get_DAG self.check_initialized() File "/usr/local/lib/python3.10/site-packages/jieba/__init__.py", line 170, in check_initialized self.initialize() File "/usr/local/lib/python3.10/site-packages/jieba/__init__.py", line 125, in initialize self.tmp_dir or tempfile.gettempdir(), cache_file) File "/usr/local/lib/python3.10/tempfile.py", line 315, in gettempdir return _os.fsdecode(_gettempdir()) File "/usr/local/lib/python3.10/tempfile.py", line 308, in _gettempdir tempdir = _get_default_tempdir() File "/usr/local/lib/python3.10/tempfile.py", line 223, in _get_default_tempdir raise FileNotFoundError(_errno.ENOENT, FileNotFoundError: [Errno 2] No usable temporary directory found in ['/tmp', '/var/tmp', '/usr/tmp', '/'] error: exit status 255
yindo added the 🐞 bugoutdated labels 2026-02-21 19:48:55 -05:00
yindo closed this issue 2026-02-21 19:48:55 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#18541