thedotmack/claude-mem · error
ValidationError
ValidationError
Error message
memory_items requires at least one searchable text field (narrative, text, title, subtitle, facts, or concepts) so the FTS index is populated; refusing to persist an empty record
What it means
The memory_items create route enforces the write-path contract that every persisted memory item must populate at least one FTS-searchable text column (narrative, text, title, subtitle, facts, concepts). A body with none of these is rejected with 400 ValidationError because the FTS trigger would produce an empty index entry — an unsearchable ('invisible') record.
Solutions
- Include at least one non-empty searchable field — e.g. set narrative or text to a meaningful summary
- If a record truly has no content, skip persisting it or store a synthetic title describing the absence
- Check the payload keys match exactly the supported field names (typos silently yield 'no searchable content')
Example fix
// before
await client.createMemoryItem({ projectId, kind: 'note', tags: ['x'] }); // 400
// after
await client.createMemoryItem({
projectId,
kind: 'note',
title: 'note',
narrative: 'Captured observation about X',
tags: ['x'],
}); Defensive patterns
Strategy: validation
Validate before calling
const SEARCHABLE = ['narrative', 'text', 'title', 'subtitle', 'facts', 'concepts'];
function hasSearchableContent(item) {
return SEARCHABLE.some(k => {
const v = item[k];
return typeof v === 'string' ? v.trim().length > 0 : Array.isArray(v) && v.length > 0;
});
}
if (!hasSearchableContent(body)) throw new Error('memory item needs a searchable text field'); Type guard
function isPersistableMemoryItem(b) {
return ['narrative','text','title','subtitle','facts','concepts'].some(k => b[k] != null && b[k].length > 0);
} Try / catch
try { await client.createMemoryItem(body); }
catch (e) {
if (e.status === 400 && /searchable text field/.test(e.message ?? '')) {
return client.createMemoryItem({ ...body, narrative: body.narrative || '(no content)' });
}
throw e;
} Prevention
- Always populate title or narrative, even for metadata-only records
- Validate payloads with hasSearchableContent before sending
- Watch for key renames in clients that silently empty the text fields
When it happens
Trigger: POST /v1/memory-items with a body containing only metadata (ids, tags, timestamps) and none of narrative/text/title/subtitle/facts/concepts, or with all of them empty strings/empty arrays.
Common situations: Bulk importers syncing records that genuinely lack text (placeholder rows); refactors renaming a text field so the payload no longer matches the expected keys; clients sending { facts: [] } or title: '' assuming empties count as content.
Understand the failure class
Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.
Related errors
- FTS fallback failed for observations
- FTS fallback failed for timeline
- INVALID_SEARCH_REQUEST
- observation_search: "query" is required
- ValidationError
AI-assisted analysis of thedotmack/claude-mem@d8bc9755e7 (2026-09-17).
Data as JSON: /api/errors/ede3de5b217a520a.
Report an issue: GitHub.
Appendix: source
Thrown at src/server/routes/v1/ServerV1Routes.ts:191
const event = new AgentEventsRepository(this.options.getDatabase()).getById(id);
if (!event) {
res.status(404).json({ error: 'NotFound', message: 'Event not found' });
return;
}
if (!this.ensureProjectAllowed(req, res, event.projectId)) return;
this.audit(req, 'event.read', event.id, event.projectId);
res.json({ event });
});
app.post('/v1/memories', writeAuth, this.handleCreate(CreateMemoryItemSchema, (req, res, body) => {
if (!this.ensureProjectAllowed(req, res, body.projectId)) return;
// Write-path contract (#2684/#2533): the FTS trigger (trg_memory_items_fts_insert)
// copies title/subtitle/text/narrative/facts/concepts into the search index.
// A row with NONE of the searchable text columns populated is invisible to
// search — it looks "frozen". Reject it LOUDLY here instead of silently
// persisting an unsearchable record.
if (!hasSearchableContent(body)) {
res.status(400).json({
error: 'ValidationError',
message: 'memory_items requires at least one searchable text field (narrative, text, title, subtitle, facts, or concepts) so the FTS index is populated; refusing to persist an empty record',
});
return;
}
const memory = new MemoryItemsRepository(this.options.getDatabase()).create(body);
this.audit(req, 'memory.write', memory.id, memory.projectId);
res.status(201).json({ memory });
}));
app.get('/v1/memories/:id', readAuth, (req, res) => {
const id = this.routeParam(req.params.id);
const memory = new MemoryItemsRepository(this.options.getDatabase()).getById(id);
if (!memory) {
res.status(404).json({ error: 'NotFound', message: 'Memory not found' });
return;
}
if (!this.ensureProjectAllowed(req, res, memory.projectId)) return;View on GitHub (pinned to d8bc9755e7)