infiniflow/ragflow · error · ContractError

CodeExec business output name must not be empty

Error message

CodeExec business output name must not be empty

What it means

Error "CodeExec business output name must not be empty" thrown in infiniflow/ragflow.

Source

Thrown at agent/tools/code_exec.py:57

        "actual_type",
        "attachments",
        "_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]

View on GitHub (pinned to 554fb1133a)

Solutions

  1. Provide a non-empty name for the CodeExec business output.
  2. Review the output contract definition and remove blank names.

Example fix

outputs = [{'name': 'result', 'type': 'Object'}]  # name must be non-empty

When it happens

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

Common situations: A CodeExec tool contract declares an output with an empty or whitespace-only name; validating output names at configuration time prevents this error.


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