{"record":{"id":"0224ba25e5f3f8cb","repo":"OpenBMB/ChatDev","slug":"log-level-must-be-either-debug-or-info-0224ba","errorCode":null,"errorMessage":"log_level must be either DEBUG or INFO","messagePattern":"log_level must be either DEBUG or INFO","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"warning","filePath":"server/routes/execute.py","lineNumber":21,"sourceCode":"from fastapi import APIRouter, HTTPException\n\nfrom entity.enums import LogLevel\nfrom server.models import WorkflowRequest\nfrom server.state import ensure_known_session\nfrom utils.exceptions import ValidationError, WorkflowExecutionError\nfrom utils.structured_logger import get_server_logger, LogType\n\nrouter = APIRouter()\n\n\n@router.post(\"/api/workflow/execute\")\nasync def execute_workflow(request: WorkflowRequest):\n    try:\n        manager = ensure_known_session(request.session_id, require_connection=True)\n        # log_level = LogLevel(request.log_level) if request.log_level else None\n        log_level = None\n    except ValueError:\n        raise HTTPException(status_code=400, detail=\"log_level must be either DEBUG or INFO\")\n    try:\n        asyncio.create_task(\n            manager.workflow_run_service.start_workflow(\n                request.session_id,\n                request.yaml_file,\n                request.task_prompt,\n                manager,\n                attachments=request.attachments,\n                log_level=log_level,\n            )\n        )\n\n        logger = get_server_logger()\n        logger.info(\n            \"Workflow execution started\",\n            log_type=LogType.WORKFLOW,\n            session_id=request.session_id,\n            yaml_file=request.yaml_file,","sourceCodeStart":3,"sourceCodeEnd":39,"githubUrl":"https://github.com/OpenBMB/ChatDev/blob/4fb2db0ea90375ce1059f44fe03ffbd191a7a169/server/routes/execute.py#L3-L39","documentation":"execute_workflow wraps session validation in a try/except ValueError with a log_level message, but the log_level line is commented out and the handler is dead code — the except can never fire because no ValueError is raised in the try block. If you see this message, you're on a version where the conversion was active.","triggerScenarios":"Legacy versions: POST execute with request.log_level not convertible to LogLevel. Current code: unreachable; ensure_known_session failures surface as other errors.","commonSituations":"Version drift between client and server where the client still sends log_level; reading the code and being confused that the handler exists but the conversion is commented out.","solutions":["Upgrade/align client and server versions so log_level handling matches","Send only DEBUG or INFO (or omit log_level) if your server version parses it","Prefer the sync execution endpoint which accepts the full level list if you need WARNING/ERROR","Remove or restore the commented conversion to make the handler meaningful"],"exampleFix":"// before\nlog_level = LogLevel(request.log_level) if request.log_level else None\n// after\n// server: re-enable conversion or delete the dead except ValueError block\nlog_level = None","handlingStrategy":"validation","validationCode":"if request.log_level and request.log_level not in {'DEBUG', 'INFO'}:\n    request.log_level = None  # drop unsupported level before sending","typeGuard":null,"tryCatchPattern":"except HTTPError as e:\n    if e.response.status_code == 400 and 'log_level' in e.response.text:\n        request.log_level = None\n        retry(request)","preventionTips":["Pin client and server versions together","Prefer the sync endpoint when you need non-DEBUG/INFO levels"],"tags":["dead-code","logging","http-400"],"backgroundTag":"invalid-enum-value","analyzedSha":"4fb2db0ea90375ce1059f44fe03ffbd191a7a169","analyzedAt":"2026-08-27T14:35:29.622Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}