{"record":{"id":"4f42a9bc75938e20","repo":"bytedance/deer-flow","slug":"failed-to-create-agent-res-statustext","errorCode":null,"errorMessage":"Failed to create agent: ${res.statusText}","messagePattern":"Failed to create agent: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"frontend/src/core/agents/api.ts","lineNumber":63,"sourceCode":"\nexport async function getAgent(name: string): Promise<Agent> {\n  const res = await fetch(`${getBackendBaseURL()}/api/agents/${name}`);\n  if (!res.ok) throw new Error(`Agent '${name}' not found`);\n  return res.json() as Promise<Agent>;\n}\n\nexport async function createAgent(request: CreateAgentRequest): Promise<Agent> {\n  const res = await fetch(`${getBackendBaseURL()}/api/agents`, {\n    method: \"POST\",\n    headers: { \"Content-Type\": \"application/json\" },\n    body: JSON.stringify(request),\n  });\n  if (!res.ok) {\n    const err = (await res.json().catch(() => ({}))) as { detail?: string };\n    if (isAgentsApiDisabledDetail(err.detail)) {\n      throw new AgentsApiDisabledError(err.detail!);\n    }\n    throw new Error(err.detail ?? `Failed to create agent: ${res.statusText}`);\n  }\n  return res.json() as Promise<Agent>;\n}\n\nexport async function updateAgent(\n  name: string,\n  request: UpdateAgentRequest,\n): Promise<Agent> {\n  const res = await fetch(`${getBackendBaseURL()}/api/agents/${name}`, {\n    method: \"PUT\",\n    headers: { \"Content-Type\": \"application/json\" },\n    body: JSON.stringify(request),\n  });\n  if (!res.ok) {\n    const err = (await res.json().catch(() => ({}))) as { detail?: string };\n    throw new Error(err.detail ?? `Failed to update agent: ${res.statusText}`);\n  }\n  return res.json() as Promise<Agent>;","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/bytedance/deer-flow/blob/1dd6ba1acb03700589994b0366c5d1c7d05e2eff/frontend/src/core/agents/api.ts#L45-L81","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Fix the service-side cause shown in the chained Mem0APIError text (reachability, key, mem0 health).","Accept best-effort persistence by setting write_policy: log_and_drop so failed writes log a warning and the conversation continues.","Raise timeout_seconds if writes of large conversations exceed the budget."],"exampleFix":"# before\nbackend_config:\n  write_policy: raise\n\n# after\nbackend_config:\n  write_policy: log_and_drop  # log warning, drop the update","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"from deerflow.agents.memory.backends.mem0.mem0_manager import MemoryManagerError\n\ntry:\n    manager.add(thread_id, messages)\nexcept MemoryManagerError as e:\n    if 'mem0 write failed' in str(e):\n        logger.warning('memory write dropped, conversation continues: %s', e)\n    else:\n        raise","preventionTips":["Prefer write_policy: log_and_drop for conversational memory: losing one update usually beats failing the turn.","If you keep write_policy: raise, wrap the add() call site in an explicit fallback and alert on it.","Track mem0 error rates; a rising rate means fix the service, not the policy."],"tags":["mem0","runtime","network","failure-policy","memory"],"backgroundTag":null,"analyzedSha":"1dd6ba1acb03700589994b0366c5d1c7d05e2eff","analyzedAt":"2026-08-14T21:20:34.804Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}