OpenBMB/ChatDev · error · RuntimeError
Failed to persist attachment '{attachment.name or attachment
Error message
Failed to persist attachment '{attachment.name or attachment.attachment_id}': {exc} What it means
Wrapping error from _persist_message_attachments: writing a message attachment to the workspace/attachment store raised an unexpected exception (I/O error, registration failure, bad data URI). The original exception is chained via 'from exc'.
Source
Thrown at runtime/node/executor/agent_executor.py:1083
return default_limit
custom_limit = model.params.get("tool_loop_limit")
if isinstance(custom_limit, int) and custom_limit > 0:
return custom_limit
return default_limit
def _persist_message_attachments(self, message: Message, node_id: str) -> None:
"""Register attachments produced by model outputs to the attachment store."""
store = self.context.global_state.get("attachment_store")
if store is None:
return
for block in message.blocks():
attachment = block.attachment
if not attachment:
continue
try:
self._persist_single_attachment(store, block, node_id)
except Exception as exc:
raise RuntimeError(f"Failed to persist attachment '{attachment.name or attachment.attachment_id}': {exc}") from exc
def _persist_single_attachment(self, store: Any, block: MessageBlock, node_id: str) -> None:
attachment = block.attachment
if attachment is None:
return
if attachment.remote_file_id and not attachment.data_uri and not attachment.local_path:
record = store.register_remote_file(
remote_file_id=attachment.remote_file_id,
name=attachment.name or attachment.attachment_id or "remote_file",
mime_type=attachment.mime_type,
size=attachment.size,
kind=block.type,
attachment_id=attachment.attachment_id,
)
block.attachment = record.ref
return
workspace_root = self.context.global_state.get("python_workspace_root")View on GitHub (pinned to 4fb2db0ea9)
Solutions
- Inspect the chained __cause__ exception — it carries the real failure
- Verify python_workspace_root in context.global_state is writable and mounted
- Check the attachment has valid local_path/data_uri/data_bytes before executing the node
- Retry after fixing storage; persist attachments before generating long conversations
Defensive patterns
Strategy: try-catch
Validate before calling
import os assert os.access(workspace_root, os.W_OK), 'workspace not writable'
Try / catch
try:
executor.execute(node, inputs)
except RuntimeError as e:
if 'Failed to persist attachment' in str(e):
cause = e.__cause__ # real storage failure
... Prevention
- Health-check workspace writability before long runs
- Keep disk/volume capacity monitoring on the workspace dir
When it happens
Trigger: Any exception while persisting an attachment block: unwritable workspace directory, corrupt data_uri, store.register_file failure, permission errors during copy2.
Common situations: Read-only or full disk workspace; container missing volume mount; attachment uploaded as a data URI that fails decoding; store backend (DB/object store) outage mid-run.
Related errors
- memory store {attachment.name} not found
- Workspace or node context missing for attachment persistence
- Attachment missing data for persistence
- Failed to save workflow file
- Failed to update workflow id after rename
AI-assisted analysis of OpenBMB/ChatDev@4fb2db0ea9 (2026-08-27).
Data as JSON: /api/errors/2825b67bf818355c.
Report an issue: GitHub.