iflytek/astron-agent · error · CustomException

CODE_EXECUTION_ERROR

CODE_EXECUTION_ERROR

Error message

The local code executor is disabled for security. Configure an isolated code executor before running code nodes.

What it means

The LocalCodeExecutor is a deliberately gutted implementation: its execute() method unconditionally raises CODE_EXECUTION_ERROR with a fixed message stating the local executor is disabled for security, because running untrusted code on the host (no isolation of filesystem, network, or OS user) is unsafe. Any workflow code node routed to the local executor fails immediately.

Solutions

  1. Deploy and configure an isolated code executor (e.g. the iFly sandbox service) and point the code node's executor config at it.
  2. Set the executor selection config/env so code nodes no longer resolve to LocalCodeExecutor.
  3. If local execution must be enabled, do so only inside a hardened isolated container — never on the host directly.
  4. Update deployment docs/checks to fail fast with a config validation error before running workflows.

Example fix

// before: executor defaults to local
executor = get_executor("local")
// after: require an isolated executor in config
executor_type = config.get("code_executor_type")
if executor_type in (None, "local"):
    raise ValueError("Configure an isolated code executor (code_executor_type) before running code nodes")
executor = get_executor(executor_type)
Defensive patterns

Strategy: validation

Validate before calling

executor_type = config.get("code_executor_type")
if not executor_type or executor_type == "local":
    raise ValueError("code_executor_type must point to an isolated executor (not 'local')")

Type guard

def is_isolated_executor(executor) -> bool:
    return not isinstance(executor, LocalCodeExecutor)

Try / catch

try:
    output = await code_node.async_execute(...)
except CustomException as e:
    if "disabled for security" in str(e.err_msg):
        raise RuntimeError("Deploy and configure an isolated code executor before using code nodes") from e

Prevention

When it happens

Trigger: Selecting/configuring the code node to use the local executor — i.e. no isolated (remote/sandboxed) code executor is configured — and then executing any code node.

Common situations: Self-hosted deployments where nobody configured an isolated code-executor backend, so the default falls back to local; fresh installs following outdated docs; environments where the sandbox service was never deployed.

Related errors


AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12). Data as JSON: /api/errors/8fe9ef1af7216c57. Report an issue: GitHub.

Appendix: source

Thrown at core/workflow/engine/nodes/code/executor/local/local_executor.py:20

from workflow.engine.nodes.code.executor.base_executor import BaseExecutor
from workflow.exception.e import CustomException
from workflow.exception.errors.err_code import CodeEnum
from workflow.extensions.otlp.trace.span import Span


class LocalExecutor(BaseExecutor):
    """Compatibility shim for the removed in-process code executor.

    User-provided code must never execute in the workflow service process. A
    child process and a timeout do not isolate the filesystem, credentials,
    network, or operating-system user from untrusted code.
    """

    async def execute(
        self, language: str, code: str, timeout: int, span: Span, **kwargs: Any
    ) -> str:
        raise CustomException(
            err_code=CodeEnum.CODE_EXECUTION_ERROR,
            err_msg=(
                "The local code executor is disabled for security. "
                "Configure an isolated code executor before running code nodes."
            ),
        )

View on GitHub (pinned to 5e758547a8)