Intermittent "Node {Code node name} run failed: error: operation not permitted" when code block is placed right after input block in workflows #3578

Closed
opened 2026-02-21 17:59:30 -05:00 by yindo · 0 comments
Owner

Originally created by @sigvardt on GitHub (May 22, 2024).

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).
  • Please do not modify this template :) and fill in all the required fields.

Dify version

Version 0.6.8

Cloud or Self Hosted

Cloud

Steps to reproduce

For workflows, make the following setup:

  1. Make a workflow which has a code execution block right after the input block

Example code which provokes the issue:
`def main(text: str) -> dict:
"""
Escapes unescaped newline characters in the given string.

Args:
text (str): The input string containing potential unescaped newline characters.

Returns:
dict: A dictionary containing the key 'result' with the value being the new string with all unescaped newline characters escaped.
"""
escaped_text = []
i = 0
while i < len(text):
    if text[i] == '\\' and i + 1 < len(text) and text[i + 1] == 'n':
        # This is already an escaped newline
        escaped_text.append('\\n')
        i += 2
    elif text[i] == '\n':
        # This is an unescaped newline
        escaped_text.append('\\n')
        i += 1
    else:
        escaped_text.append(text[i])
        i += 1

return {
    'result': ''.join(escaped_text)
}

`

Seems to be a timing issue. If you move the block down in the line of the workflow, then the issue never happens.

✔️ Expected Behavior

  • Code execution node intermittently fails, but completes always upon retry

Actual Behavior

  • Consistent success or failure
Originally created by @sigvardt on GitHub (May 22, 2024). ### 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] Please do not modify this template :) and fill in all the required fields. ### Dify version Version 0.6.8 ### Cloud or Self Hosted Cloud ### Steps to reproduce For workflows, make the following setup: 1. Make a workflow which has a code execution block right after the input block Example code which provokes the issue: `def main(text: str) -> dict: """ Escapes unescaped newline characters in the given string. Args: text (str): The input string containing potential unescaped newline characters. Returns: dict: A dictionary containing the key 'result' with the value being the new string with all unescaped newline characters escaped. """ escaped_text = [] i = 0 while i < len(text): if text[i] == '\\' and i + 1 < len(text) and text[i + 1] == 'n': # This is already an escaped newline escaped_text.append('\\n') i += 2 elif text[i] == '\n': # This is an unescaped newline escaped_text.append('\\n') i += 1 else: escaped_text.append(text[i]) i += 1 return { 'result': ''.join(escaped_text) } ` Seems to be a timing issue. If you move the block down in the line of the workflow, then the issue never happens. ### ✔️ Expected Behavior - Code execution node intermittently fails, but completes always upon retry ### ❌ Actual Behavior - Consistent success or failure
yindo added the 🐞 bug label 2026-02-21 17:59:30 -05:00
yindo closed this issue 2026-02-21 17:59:30 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#3578