bytedance/deer-flow · error

Failed to create agent: ${res.statusText}

Error message

Failed to create agent: ${res.statusText}

What it means

Wrapped MemoryManagerError raised by Mem0Manager._write_or_drop when a memory write raises Mem0APIError and the configured write_policy is not log_and_drop. The original transport or API error is preserved as the cause and its text is embedded in the message.

Source

Thrown at frontend/src/core/agents/api.ts:63

export async function getAgent(name: string): Promise<Agent> {
  const res = await fetch(`${getBackendBaseURL()}/api/agents/${name}`);
  if (!res.ok) throw new Error(`Agent '${name}' not found`);
  return res.json() as Promise<Agent>;
}

export async function createAgent(request: CreateAgentRequest): Promise<Agent> {
  const res = await fetch(`${getBackendBaseURL()}/api/agents`, {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify(request),
  });
  if (!res.ok) {
    const err = (await res.json().catch(() => ({}))) as { detail?: string };
    if (isAgentsApiDisabledDetail(err.detail)) {
      throw new AgentsApiDisabledError(err.detail!);
    }
    throw new Error(err.detail ?? `Failed to create agent: ${res.statusText}`);
  }
  return res.json() as Promise<Agent>;
}

export async function updateAgent(
  name: string,
  request: UpdateAgentRequest,
): Promise<Agent> {
  const res = await fetch(`${getBackendBaseURL()}/api/agents/${name}`, {
    method: "PUT",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify(request),
  });
  if (!res.ok) {
    const err = (await res.json().catch(() => ({}))) as { detail?: string };
    throw new Error(err.detail ?? `Failed to update agent: ${res.statusText}`);
  }
  return res.json() as Promise<Agent>;

View on GitHub (pinned to 1dd6ba1acb)

Solutions

  1. Fix the service-side cause shown in the chained Mem0APIError text (reachability, key, mem0 health).
  2. Accept best-effort persistence by setting write_policy: log_and_drop so failed writes log a warning and the conversation continues.
  3. Raise timeout_seconds if writes of large conversations exceed the budget.

Example fix

# before
backend_config:
  write_policy: raise

# after
backend_config:
  write_policy: log_and_drop  # log warning, drop the update
Defensive patterns

Strategy: fallback

Try / catch

from deerflow.agents.memory.backends.mem0.mem0_manager import MemoryManagerError

try:
    manager.add(thread_id, messages)
except MemoryManagerError as e:
    if 'mem0 write failed' in str(e):
        logger.warning('memory write dropped, conversation continues: %s', e)
    else:
        raise

Prevention

When it happens

Trigger: Submitting conversation turns to mem0 (the add() path) while the service errors (connection refused, timeout, auth failure, 5xx) with write_policy: raise. With write_policy: log_and_drop the same failure is swallowed with a warning and the update is dropped.

Common situations: mem0 service down or restarting when a turn ends; API key revoked between read and write; strict write_policy chosen to avoid silent memory loss, after which a transient outage makes every turn fail.

Related errors


AI-assisted analysis of bytedance/deer-flow@1dd6ba1acb (2026-08-14). Data as JSON: /api/errors/4f42a9bc75938e20. Report an issue: GitHub.