bytedance/deer-flow · warning · HTTPException
Fact was not stored because memory.max_facts kept higher-con
Error message
Fact was not stored because memory.max_facts kept higher-confidence facts
What it means
409 Conflict returned when create_fact returns a None fact_id: the store is at its memory.max_facts cap, and the newly submitted fact had lower confidence than every stored fact, so it was evicted (not stored) to preserve higher-confidence facts. This is deliberate capacity control, not a crash.
Source
Thrown at backend/app/gateway/routers/memory.py:334
memory_data, fact_id = await asyncio.to_thread(
manager.create_fact,
content=request.content,
category=request.category,
confidence=request.confidence,
user_id=_resolve_memory_user_id(http_request),
)
except NotImplementedError:
raise _unsupported_501(manager, "create fact") from None
except ValueError as exc:
raise _map_memory_fact_value_error(exc) from exc
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 create memory fact.") from exc
if fact_id is None:
# max_facts cap evicted the new (lower-confidence) fact; it was not stored.
raise HTTPException(status_code=409, detail="Fact was not stored because memory.max_facts kept higher-confidence facts")
return MemoryResponse(**memory_data)
@router.delete(
"/memory/facts/{fact_id}",
response_model=MemoryResponse,
response_model_exclude_none=True,
summary="Delete Memory Fact",
description="Delete a single saved memory fact by its fact id.",
)
async def delete_memory_fact_endpoint(fact_id: str, http_request: Request) -> MemoryResponse:
"""Delete a single fact from memory by fact id."""
manager = await asyncio.to_thread(get_memory_manager)
try:
memory_data = await asyncio.to_thread(manager.delete_fact, fact_id, user_id=_resolve_memory_user_id(http_request))
except NotImplementedError:
raise _unsupported_501(manager, "delete fact") from None
except KeyError as exc:View on GitHub (pinned to 1dd6ba1acb)
Solutions
- Raise memory.max_facts in config.yaml if the cap is too small for the workload
- Submit the fact with a higher confidence value so it outranks stored facts and earns a slot
- Delete lower-value facts first (DELETE /api/memory/facts/{id}) to free capacity
Example fix
# config.yaml
# before
memory:
max_facts: 100
# after
memory:
max_facts: 1000
# or, in the request body:
# before: {"content": "...", "confidence": 0.2} (evicted)
# after: {"content": "...", "confidence": 0.8} (stored) Defensive patterns
Strategy: validation
Validate before calling
const mem = await getMemory(); const cap = mem.max_facts ?? Infinity; if (Object.keys(mem.facts ?? {}).length >= cap) { const minC = Math.min(...Object.values(mem.facts).map((f: any) => f.confidence ?? 0)); if ((body.confidence ?? 0.5) <= minC) throw new Error('store at max_facts cap and new fact confidence too low — raise cap, delete facts, or raise confidence'); } Type guard
function willFactBeEvicted(currentFactCount: number, maxFacts: number, newConfidence: number, minStoredConfidence: number): boolean { return currentFactCount >= maxFacts && newConfidence <= minStoredConfidence; } Try / catch
try { return await createFact(body); } catch (e) { if (e.status === 409 && /max_facts/.test(e.detail)) { return createFact({...body, confidence: bumpConfidence(body.confidence)}); } throw e; } Prevention
- Size memory.max_facts to the expected workload in config.yaml
- Treat 409 with the max_facts detail as expected capacity control, not an outage
- Track fact counts client-side and prune low-value facts proactively
When it happens
Trigger: POST /api/memory/facts when the user already has max_facts facts and the new fact's confidence is <= the minimum stored confidence; small max_facts values in config.yaml make this easy to hit during testing.
Common situations: Default or low max_facts configured; bulk-importing facts without raising the cap; test suites creating many facts per user; agents saving low-confidence observations on a full store.
Related errors
- Directory for '{name}' contains memory data but is not a cus
- backend_config.retrieval_adapter={config.retrieval_adapter!r
- backend_config.storage_class={storage_class_path!r} failed t
- DeerMem memory update requested but no LLM is configured (se
- Honcho request failed: POST {path}: {exc}
AI-assisted analysis of bytedance/deer-flow@1dd6ba1acb (2026-08-14).
Data as JSON: /api/errors/a0138881227cafa4.
Report an issue: GitHub.