iflytek/astron-agent · error · CustomException

21600

21600

Error message

No isolated code executor is configured. The local executor is disabled for security.

What it means

The executor factory create_executor in base_executor.py rejects executor identifiers "", "disabled", and "local", raising CODE_EXECUTION_ERROR (21600) because in-process local code execution is disabled for security. All user code must run in an isolated sandbox (e.g. E2B), so requesting the local executor is always a hard configuration error.

Solutions

  1. Set the executor to an isolated type, e.g. `export CODE_EXEC_TYPE=e2b`, and configure the sandbox (E2B API key/endpoint).
  2. Grep deployment configs (docker/.env, helm values) for CODE_EXEC_TYPE=local|disabled and replace them.
  3. If this call comes from your own code, pass a supported executor identifier ('langchain', 'ifly', 'ifly-v2', 'e2b').
  4. Update old workflow templates that implicitly relied on local execution.
  5. Redeploy and run a test code node to confirm the sandbox executor initializes.

Example fix

# before
executor = create_executor("local")

# after
executor = create_executor(os.getenv("CODE_EXEC_TYPE", "e2b"))
Defensive patterns

Strategy: validation

Validate before calling

exec_type = os.getenv("CODE_EXEC_TYPE", "")
if exec_type.strip().lower() in {"", "disabled", "local"}:
    raise ValueError("CODE_EXEC_TYPE must be an isolated executor (e.g. e2b); local is disabled")

Type guard

def is_allowed_executor(v: str) -> bool:
    return v.strip().lower() not in {"", "disabled", "local"}

Try / catch

try:
    executor = create_executor(requested)
except CustomException as e:
    if e.err_code == CodeEnum.CODE_EXECUTION_ERROR and "local executor is disabled" in (e.err_msg or ""):
        executor = create_executor("e2b")  # fallback to configured sandbox
    else:
        raise

Prevention

When it happens

Trigger: Calling create_executor with executor='local' (legacy configs), an empty CODE_EXEC_TYPE, or 'disabled'; legacy workflows/migrations still referencing the removed local executor; defaults pointing at the deprecated local executor after an upgrade.

Common situations: Upgrading from a version where local execution was allowed; env files copied from old deployments; documentation/examples referencing CODE_EXEC_TYPE=local; infrastructure where the sandbox env vars were never provisioned so the code falls back to 'local'/'disabled'.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


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

Appendix: source

Thrown at core/workflow/engine/nodes/code/executor/base_executor.py:52

class CodeExecutorFactory:
    """
    Factory class for creating code executors.

    Provides a centralized way to instantiate different types of code executors
    based on configuration or runtime requirements.
    """

    @staticmethod
    def create_executor(executor: str) -> BaseExecutor:
        """
        Create a code executor instance based on the specified type.

        :param executor: Executor type identifier ("langchain", "ifly", "ifly-v2", or "e2b")
        :return: Configured executor instance
        :raises Exception: If the specified executor type is not supported
        """
        if executor in {"", "disabled", "local"}:
            raise CustomException(
                err_code=CodeEnum.CODE_EXECUTION_ERROR,
                err_msg=(
                    "No isolated code executor is configured. "
                    "The local executor is disabled for security."
                ),
            )
        elif executor == "langchain":
            # Langchain sandbox execution environment
            from workflow.engine.nodes.code.executor.langchain.langchain_executor import (
                LangchainExecutor,
            )

            return LangchainExecutor()
        elif executor == "ifly":
            # IFly remote execution service
            from workflow.engine.nodes.code.executor.ifly.ifly_executor import (
                IFlyExecutor,
            )

View on GitHub (pinned to 5e758547a8)