bytedance/deer-flow · error · HTTPException
Failed to update user profile: {str(e)}
Error message
Failed to update user profile: {str(e)} What it means
Catch-all 500 on PUT `/user-profile`: writing USER.md failed. The handler mkdirs `paths.base_dir` then `write_text`s the content; failures are permission errors creating/writing the directory, disk full, or read-only mounts. Unlike reads, no graceful path exists — a failed write is always a 500 with the cause logged.
Source
Thrown at backend/app/gateway/routers/agents.py:529
"""Create or overwrite the global USER.md.
Args:
request: The update request with the new USER.md content.
Returns:
UserProfileResponse with the saved content.
"""
_require_agents_api_enabled()
try:
paths = get_paths()
paths.base_dir.mkdir(parents=True, exist_ok=True)
paths.user_md_file.write_text(request.content, encoding="utf-8")
logger.info(f"Updated USER.md at {paths.user_md_file}")
return UserProfileResponse(content=request.content or None)
except Exception as e:
logger.error(f"Failed to update user profile: {e}", exc_info=True)
raise HTTPException(status_code=500, detail=f"Failed to update user profile: {str(e)}")
@router.delete(
"/agents/{name}",
status_code=204,
summary="Delete Custom Agent",
description="Delete a custom agent and all its files (config, SOUL.md, memory).",
)
async def delete_agent(name: str) -> None:
"""Delete a custom agent.
Args:
name: The agent name.
Raises:
HTTPException: 404 if no per-user copy exists; 409 if only a legacy
shared copy exists (suggesting the migration script).
"""View on GitHub (pinned to 1dd6ba1acb)
Solutions
- Confirm the Gateway process user can create and write under base_dir (`sudo -u <user> touch <base_dir>/probe`)
- Mount the profile directory writable, or relocate base_dir to writable storage
- Free disk space / adjust SELinux or AppArmor policy as the traceback indicates
Defensive patterns
Strategy: try-catch
Try / catch
try { return await api.updateUserProfile(content); }
catch (e) {
if (e.status === 500 && /update user profile/.test(e.detail)) {
toast('Could not save profile — server storage is not writable');
keepLocalDraft(content); // don't lose the user's text
return;
}
throw e;
} Prevention
- Verify the base_dir volume is writable by the Gateway user at deploy time
- Keep a local draft of profile edits until the save confirms
- Disk-full and read-only mounts are the two most common root causes — check both
When it happens
Trigger: base_dir on a read-only volume; Gateway process lacking write permission on the data dir; ENOSPC; SELinux denying writes.
Common situations: Hardened container deployments with immutable config mounts; first write after a permissions migration; disk-full incidents.
Related errors
- Failed to read user profile: {str(e)}
- Failed to clear memory data.
- Failed to delete local thread data.
- Failed to list agents: {str(e)}
- Failed to get agent: {str(e)}
AI-assisted analysis of bytedance/deer-flow@1dd6ba1acb (2026-08-14).
Data as JSON: /api/errors/40774c1bfceb9864.
Report an issue: GitHub.