OpenBMB/ChatDev · error · WorkflowExecutionError

Failed to save workflow file

Error message

Failed to save workflow file

What it means

persist_workflow wraps save_path.write_text in a broad try/except and re-raises WorkflowExecutionError when writing the workflow file fails for any OS-level reason (permissions, disk full, missing parent directory). The original exception is logged via logger.log_exception first.

Source

Thrown at server/services/workflow_storage.py:99

    return safe_filename, yaml_content


def persist_workflow(
    safe_filename: str,
    content: str,
    yaml_content: Any,
    *,
    action: str,
    directory: Path,
) -> None:
    save_path = directory / safe_filename
    logger = get_server_logger()

    try:
        save_path.write_text(content, encoding="utf-8")
    except Exception as exc:
        logger.log_exception(exc, f"Failed to save workflow file {safe_filename}")
        raise WorkflowExecutionError(
            "Failed to save workflow file", details={"filename": safe_filename}
        )

    logger.info(
        "Workflow file persisted",
        log_type=LogType.WORKFLOW,
        filename=safe_filename,
        action=action,
    )


def rename_workflow(source_filename: str, target_filename: str, *, directory: Path) -> None:
    source_safe = validate_workflow_filename(source_filename, require_yaml_extension=True)
    target_safe = validate_workflow_filename(target_filename, require_yaml_extension=True)

    if source_safe == target_safe:
        raise ValidationError("Source and target filenames must be different", field="new_filename")

View on GitHub (pinned to 4fb2db0ea9)

Solutions

  1. Check the server log for the underlying exception logged by log_exception
  2. Verify write permission on the target directory (chmod/chown) and that it exists
  3. Free disk space or expand the volume
  4. Ensure the directory is created (mkdir parents=True) before persisting

Example fix

# before
save_path.write_text(content, encoding="utf-8")
# after (defensive caller)
workflow_dir.mkdir(parents=True, exist_ok=True)
persist_workflow(safe_filename, content, directory=workflow_dir)
Defensive patterns

Strategy: try-catch

Validate before calling

workflow_dir.mkdir(parents=True, exist_ok=True)
assert os.access(workflow_dir, os.W_OK), 'workflows dir not writable'

Try / catch

try:
    persist_workflow(name, content, directory=d)
except WorkflowExecutionError as e:
    logger.error('persist failed', e.details)
    alert_ops_check_disk_and_perms()

Prevention

When it happens

Trigger: Calling persist_workflow when the workflows directory is read-only, the disk is full, the parent directory was deleted between validation and save, or the process lacks write permissions.

Common situations: Running the server as a non-root user against a root-owned directory; container with a read-only volume mounted at the workflows path; disk quota exceeded in CI.

Related errors


AI-assisted analysis of OpenBMB/ChatDev@4fb2db0ea9 (2026-08-27). Data as JSON: /api/errors/bfafe0b3e6e856f7. Report an issue: GitHub.