{"record":{"id":"d19b34e457cabeb4","repo":"infiniflow/ragflow","slug":"codeexec-business-output-name-must-not-be-empty","errorCode":null,"errorMessage":"CodeExec business output name must not be empty","messagePattern":"CodeExec business output name must not be empty","errorType":"validation","errorClass":"ContractError","httpStatus":null,"severity":"error","filePath":"agent/tools/code_exec.py","lineNumber":57,"sourceCode":"        \"actual_type\",\n        \"attachments\",\n        \"_ERROR\",\n        \"_ARTIFACTS\",\n        \"_ATTACHMENT_CONTENT\",\n        \"raw_result\",\n        \"_created_time\",\n        \"_elapsed_time\",\n    }\n)\n\n\nclass ContractError(ValueError):\n    pass\n\n\ndef _validate_business_output_name(name: str) -> None:\n    if not name or not name.strip():\n        raise ContractError(\"CodeExec business output name must not be empty\")\n    if name in SYSTEM_OUTPUT_KEYS:\n        raise ContractError(f\"CodeExec reserved output name is not allowed: {name}\")\n    if \".\" in name:\n        raise ContractError(f\"CodeExec business output name must not contain '.': {name}\")\n\n\ndef select_business_output(outputs: Mapping[str, object]) -> tuple[str, object]:\n    if len(outputs) == 1:\n        only_name, only_meta = next(iter(outputs.items()))\n        _validate_business_output_name(only_name)\n        return only_name, only_meta\n\n    business_outputs = [(name, meta) for name, meta in outputs.items() if name not in SYSTEM_OUTPUT_KEYS]\n    if len(business_outputs) != 1:\n        raise ContractError(f\"CodeExec contract must contain exactly one business output, got {len(business_outputs)}\")\n    _validate_business_output_name(business_outputs[0][0])\n    return business_outputs[0]\n","sourceCodeStart":39,"sourceCodeEnd":75,"githubUrl":"https://github.com/infiniflow/ragflow/blob/554fb1133ac3861732235ad9c377eb5e0a770665/agent/tools/code_exec.py#L39-L75","documentation":"Error \"CodeExec business output name must not be empty\" thrown in infiniflow/ragflow.","triggerScenarios":"Thrown at agent/tools/code_exec.py:57 when the library encounters an invalid state.","commonSituations":"A CodeExec tool contract declares an output with an empty or whitespace-only name; validating output names at configuration time prevents this error.","solutions":["Provide a non-empty name for the CodeExec business output.","Review the output contract definition and remove blank names."],"exampleFix":"outputs = [{'name': 'result', 'type': 'Object'}]  # name must be non-empty","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"554fb1133ac3861732235ad9c377eb5e0a770665","analyzedAt":"2026-08-15T09:20:16.380Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}