OpenBMB/ChatDev · warning · HTTPException
log_level must be either DEBUG or INFO
Error message
log_level must be either DEBUG or INFO
What it means
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.
Source
Thrown at server/routes/execute.py:21
from fastapi import APIRouter, HTTPException
from entity.enums import LogLevel
from server.models import WorkflowRequest
from server.state import ensure_known_session
from utils.exceptions import ValidationError, WorkflowExecutionError
from utils.structured_logger import get_server_logger, LogType
router = APIRouter()
@router.post("/api/workflow/execute")
async def execute_workflow(request: WorkflowRequest):
try:
manager = ensure_known_session(request.session_id, require_connection=True)
# log_level = LogLevel(request.log_level) if request.log_level else None
log_level = None
except ValueError:
raise HTTPException(status_code=400, detail="log_level must be either DEBUG or INFO")
try:
asyncio.create_task(
manager.workflow_run_service.start_workflow(
request.session_id,
request.yaml_file,
request.task_prompt,
manager,
attachments=request.attachments,
log_level=log_level,
)
)
logger = get_server_logger()
logger.info(
"Workflow execution started",
log_type=LogType.WORKFLOW,
session_id=request.session_id,
yaml_file=request.yaml_file,View on GitHub (pinned to 4fb2db0ea9)
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
Example fix
// before log_level = LogLevel(request.log_level) if request.log_level else None // after // server: re-enable conversion or delete the dead except ValueError block log_level = None
Defensive patterns
Strategy: validation
Validate before calling
if request.log_level and request.log_level not in {'DEBUG', 'INFO'}:
request.log_level = None # drop unsupported level before sending Try / catch
except HTTPError as e:
if e.response.status_code == 400 and 'log_level' in e.response.text:
request.log_level = None
retry(request) Prevention
- Pin client and server versions together
- Prefer the sync endpoint when you need non-DEBUG/INFO levels
When it happens
Trigger: Legacy versions: POST execute with request.log_level not convertible to LogLevel. Current code: unreachable; ensure_known_session failures surface as other errors.
Common situations: 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.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- log_level must be either DEBUG or INFO
- log_level must be one of DEBUG, INFO, WARNING, ERROR, CRITIC
- invalid_yaml
- max_parallel must be >= 1
- Task prompt cannot be empty
AI-assisted analysis of OpenBMB/ChatDev@4fb2db0ea9 (2026-08-27).
Data as JSON: /api/errors/0224ba25e5f3f8cb.
Report an issue: GitHub.