bytedance/deer-flow · error · HTTPException
Failed to import memory data.
Error message
Failed to import memory data.
What it means
Raised as HTTP 500 by the memory import endpoint when manager.import_memory raises OSError — the imported payload was accepted but could not be persisted to the memory store. Validation and conflict/corruption failures are mapped to other statuses; this is purely an I/O write failure.
Source
Thrown at backend/app/gateway/routers/memory.py:430
response_model_exclude_none=True,
summary="Import Memory Data",
description="Import and overwrite the current global memory data from a JSON payload.",
)
async def import_memory(request: MemoryResponse, http_request: Request) -> MemoryResponse:
"""Import and persist memory data."""
manager = await asyncio.to_thread(get_memory_manager)
try:
memory_data = await asyncio.to_thread(
manager.import_memory,
request.model_dump(exclude_none=True),
user_id=_resolve_memory_user_id(http_request),
)
except NotImplementedError:
raise _unsupported_501(manager, "import memory") from None
except (MemoryConflictError, MemoryCorruptionError) as exc:
raise _map_memory_manager_error(exc) from exc
except OSError as exc:
raise HTTPException(status_code=500, detail="Failed to import memory data.") from exc
return MemoryResponse(**memory_data)
@router.get(
"/memory/config",
response_model=MemoryConfigResponse,
summary="Get Memory Configuration",
description="Retrieve the current memory system configuration.",
)
async def get_memory_config_endpoint() -> MemoryConfigResponse:
"""Get the memory system configuration.
Returns:
The current memory configuration. The response is backend-agnostic:
``enabled`` / ``injection_enabled`` / ``mode`` are mechanism-level
fields that apply to any backend (``mode`` selects middleware vs tool
operation), and ``backend_config`` is an opaque dict the activeView on GitHub (pinned to 1dd6ba1acb)
Solutions
- Check Gateway logs for the underlying OSError to identify the path and errno.
- Make the memory store writable and ensure free disk space, then retry the import — the endpoint replaces state, so a retry after a failed write is safe.
- If the store was left partially written, restore from the exported backup you are importing (or another export) before retrying.
Defensive patterns
Strategy: retry
Validate before calling
payload = json.load(open("memory_backup.json"))
required = {"facts"} # keys produced by /memory/export
missing = required - payload.keys()
assert not missing, f"backup missing keys: {missing}" Type guard
def is_valid_export(doc: dict) -> bool:
return isinstance(doc, dict) and "facts" in doc and isinstance(doc["facts"], list) Try / catch
resp = requests.post(f"{BASE}/api/memory/import", json=payload)
if resp.status_code == 500:
# I/O failure mid-import: verify store health, then retry — import is a replace operation
check_store_health_then_retry(payload) Prevention
- Export before you import, so any failed import is recoverable.
- Verify writability of the store before starting a large import.
- Do not run import while heavy memory traffic is in flight.
When it happens
Trigger: POST /api/memory/import with a JSON body (typically from a prior /memory/export) while the store write fails: unwritable directory, full disk, or locked store file.
Common situations: Restoring a backup into a container whose data volume is read-only or full; importing concurrently with a large write from another request.
Related errors
- Failed to clear memory data.
- Failed to create memory fact.
- Failed to delete memory fact.
- Failed to update memory fact.
- Failed to list agents: {str(e)}
AI-assisted analysis of bytedance/deer-flow@1dd6ba1acb (2026-08-14).
Data as JSON: /api/errors/be8479fc118a8918.
Report an issue: GitHub.