Problem
Production note indexing jobs crash with KeyError raised from inside loguru's message formatting, exhaust all 5 PGQueuer attempts, and terminally fail. The affected notes never index until a later unrelated touch.
Logfire issues (basic-memory-cloud project): #2391 e41e60d1-3f50-4fb8-84ff-ae7c676ff4e8 (entrypoint index_file) and #2393 65936064-3a57-4b61-90e8-347ea8d55dda (entrypoint index_file_batch), both 2026-08-08.
Representative traces (auth-gated):
Root cause (trace-proven)
Both stacktraces bottom out identically:
basic_memory.index.local_dependencies.index_markdown_file:345
loguru._logger.info:2078
loguru._logger._log:2055
KeyError: <customer-derived key, redacted>
Line 345 is the retry log emitted between attempts of the note-content reconcile loop. Customer-derived text (a note path/title) reaches loguru's message-formatting path, and when that text contains literal braces — e.g. template-style notes containing {placeholder} — loguru interprets them as format fields and raises KeyError on the customer's own text. The exception escapes the reconcile loop, the job retries with identical bytes, and all 5 attempts fail the same way.
The KeyError values observed in production are single capitalized words consistent with template placeholders inside customer note names/content. They are redacted here; see the Logfire traces.
Impact
- Any note whose path/title/content puts brace-wrapped text into this log line can never be indexed by the retry path — a durable indexing gap for that customer, invisible to them.
- The failure is deterministic per note, so retries are pure waste (5 deliveries per event).
Fix
Never route customer-derived strings through loguru's format path at this call site (and audit the sibling log calls in the same loop): pass values as structured arguments/extra fields rather than interpolated message text, or escape braces. No behavior change to indexing itself.
Acceptance criteria
Problem
Production note indexing jobs crash with
KeyErrorraised from inside loguru's message formatting, exhaust all 5 PGQueuer attempts, and terminally fail. The affected notes never index until a later unrelated touch.Logfire issues (basic-memory-cloud project): #2391
e41e60d1-3f50-4fb8-84ff-ae7c676ff4e8(entrypointindex_file) and #239365936064-3a57-4b61-90e8-347ea8d55dda(entrypointindex_file_batch), both 2026-08-08.Representative traces (auth-gated):
Root cause (trace-proven)
Both stacktraces bottom out identically:
Line 345 is the retry log emitted between attempts of the note-content reconcile loop. Customer-derived text (a note path/title) reaches loguru's message-formatting path, and when that text contains literal braces — e.g. template-style notes containing
{placeholder}— loguru interprets them as format fields and raisesKeyErroron the customer's own text. The exception escapes the reconcile loop, the job retries with identical bytes, and all 5 attempts fail the same way.The KeyError values observed in production are single capitalized words consistent with template placeholders inside customer note names/content. They are redacted here; see the Logfire traces.
Impact
Fix
Never route customer-derived strings through loguru's format path at this call site (and audit the sibling log calls in the same loop): pass values as structured arguments/
extrafields rather than interpolated message text, or escape braces. No behavior change to indexing itself.Acceptance criteria
{braces}completes and the retry log line renders safely.index_markdown_file/reconcile loop for the same pattern.