infiniflow/ragflow · error · ContractError

CodeExec reserved output name is not allowed: {name}

Error message

CodeExec reserved output name is not allowed: {name}

What it means

Error "CodeExec reserved output name is not allowed: {name}" thrown in infiniflow/ragflow.

Source

Thrown at agent/tools/code_exec.py:59

        "_ERROR",
        "_ARTIFACTS",
        "_ATTACHMENT_CONTENT",
        "raw_result",
        "_created_time",
        "_elapsed_time",
    }
)


class ContractError(ValueError):
    pass


def _validate_business_output_name(name: str) -> None:
    if not name or not name.strip():
        raise ContractError("CodeExec business output name must not be empty")
    if name in SYSTEM_OUTPUT_KEYS:
        raise ContractError(f"CodeExec reserved output name is not allowed: {name}")
    if "." in name:
        raise ContractError(f"CodeExec business output name must not contain '.': {name}")


def select_business_output(outputs: Mapping[str, object]) -> tuple[str, object]:
    if len(outputs) == 1:
        only_name, only_meta = next(iter(outputs.items()))
        _validate_business_output_name(only_name)
        return only_name, only_meta

    business_outputs = [(name, meta) for name, meta in outputs.items() if name not in SYSTEM_OUTPUT_KEYS]
    if len(business_outputs) != 1:
        raise ContractError(f"CodeExec contract must contain exactly one business output, got {len(business_outputs)}")
    _validate_business_output_name(business_outputs[0][0])
    return business_outputs[0]


def normalize_output_value(value):

View on GitHub (pinned to 554fb1133a)

Solutions

  1. Rename the output; reserved names are not allowed for business outputs.
  2. Pick a descriptive name that does not collide with CodeExec reserved fields.

Example fix

# rename reserved output 'stdout' to 'result'
outputs = [{'name': 'result', 'type': 'String'}]

When it happens

Trigger: Thrown at agent/tools/code_exec.py:59 when the library encounters an invalid state.

Common situations: The CodeExec contract reuses a reserved output name such as an internal stream or status field; renaming the business output prevents this error.


AI-assisted analysis of infiniflow/ragflow@554fb1133a (2026-08-15). Data as JSON: /api/errors/b5b32f46312d92f2. Report an issue: GitHub.