{"record":{"id":"e780fd88cf0f6096","repo":"OpenBMB/ChatDev","slug":"task-prompt-cannot-be-empty-e780fd","errorCode":null,"errorMessage":"Task prompt cannot be empty","messagePattern":"Task prompt cannot be empty","errorType":"validation","errorClass":"ValidationError","httpStatus":null,"severity":"error","filePath":"server/routes/execute_sync.py","lineNumber":87,"sourceCode":"def _run_workflow_with_logger(\n    *,\n    yaml_file: Union[str, Path],\n    task_prompt: str,\n    attachments: Optional[Sequence[Union[str, Path]]],\n    session_name: Optional[str],\n    variables: Optional[dict],\n    log_level: Optional[LogLevel],\n    log_callback,\n) -> tuple[Optional[Message], dict[str, Any]]:\n    ensure_schema_registry_populated()\n\n    yaml_path = _resolve_yaml_path(yaml_file)\n    if not yaml_path.exists():\n        raise FileNotFoundError(f\"YAML file not found: {yaml_path}\")\n\n    attachments = attachments or []\n    if (not task_prompt or not task_prompt.strip()) and not attachments:\n        raise ValidationError(\n            \"Task prompt cannot be empty\",\n            details={\"task_prompt_provided\": bool(task_prompt)},\n        )\n\n    design = load_config(yaml_path, vars_override=variables)\n    normalized_session = _normalize_session_name(yaml_path, session_name)\n\n    graph_config = GraphConfig.from_definition(\n        design.graph,\n        name=normalized_session,\n        output_root=OUTPUT_ROOT,\n        source_path=str(yaml_path),\n        vars=design.vars,\n    )\n\n    if log_level:\n        graph_config.log_level = log_level\n        graph_config.definition.log_level = log_level","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/OpenBMB/ChatDev/blob/4fb2db0ea90375ce1059f44fe03ffbd191a7a169/server/routes/execute_sync.py#L69-L105","documentation":"The sync runner requires either a non-blank task_prompt or at least one attachment; when both are absent it raises ValidationError('Task prompt cannot be empty'). A whitespace-only prompt counts as empty.","triggerScenarios":"POST /workflow/run with task_prompt=\"\", task_prompt=\"   \", or null, and an empty/omitted attachments list.","commonSituations":"Clients where the prompt field is optional and left blank; forms where whitespace was submitted; automated pipelines that pass only variables but no task.","solutions":["Provide a non-empty task_prompt (trim check is applied)","Or include at least one attachment if the workflow is promptless","Validate and reject empty prompts client-side before submission"],"exampleFix":"# before\n{\"yaml_file\": \"wf.yaml\", \"task_prompt\": \"  \"}\n# after\n{\"yaml_file\": \"wf.yaml\", \"task_prompt\": \"Summarize the attached report\"}","handlingStrategy":"validation","validationCode":"prompt = (task_prompt or '').strip()\nif not prompt and not attachments:\n    raise ValueError('provide task_prompt or at least one attachment')","typeGuard":"def has_runnable_input(prompt: str | None, attachments: list) -> bool:\n    return bool((prompt or '').strip()) or bool(attachments)","tryCatchPattern":"try:\n    client.run_workflow_sync(...)\nexcept HTTPError as e:\n    if e.response.status_code == 400 and 'Task prompt cannot be empty' in e.response.text:\n        req['task_prompt'] = default_prompt; retry(req)","preventionTips":["Strip and assert non-empty prompt client-side","Require either prompt or attachment in your UI validation"],"tags":["validation","workflow","http-400"],"backgroundTag":"missing-required-field","analyzedSha":"4fb2db0ea90375ce1059f44fe03ffbd191a7a169","analyzedAt":"2026-08-27T14:35:29.622Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}