mastra-ai/mastra · error
Observational memory is not implemented by this storage adap
Error message
Observational memory is not implemented by this storage adapter (${this.constructor.name}). What it means
Thrown by the base MemoryStorageDomain's getObservationalMemory default implementation. Unlike resource support, observational memory is an optional capability, and adapters that don't support it throw this explicit error rather than returning null, so callers know the feature is unavailable rather than merely empty.
Source
Thrown at packages/core/src/storage/domains/memory/base.ts:244
orderBy?.direction && orderBy.direction in THREAD_THREAD_SORT_DIRECTION_SET
? orderBy.direction
: defaultDirection,
};
}
// ============================================
// Observational Memory Methods
// ============================================
/**
* Get the current observational memory record for a thread/resource.
* Returns the most recent active record.
*/
async getObservationalMemory(
_threadId: string | null,
_resourceId: string,
): Promise<ObservationalMemoryRecord | null> {
throw new Error(`Observational memory is not implemented by this storage adapter (${this.constructor.name}).`);
}
/**
* Get observational memory history (previous generations).
* Returns records in reverse chronological order (newest first).
*/
async getObservationalMemoryHistory(
_threadId: string | null,
_resourceId: string,
_limit?: number,
_options?: ObservationalMemoryHistoryOptions,
): Promise<ObservationalMemoryRecord[]> {
throw new Error(`Observational memory is not implemented by this storage adapter (${this.constructor.name}).`);
}
/**
* Create a new observational memory record.
* Called when starting observations for a new thread/resource.View on GitHub (pinned to 75dd419e61)
Solutions
- Switch to a storage adapter that implements observational memory (e.g. current PostgreSQL, MongoDB, or InMemory adapter).
- Upgrade your adapter package to the latest version supporting observational memory.
- Disable observational memory in the Memory configuration if your adapter can't support it.
- Implement the observational-memory method family in your custom adapter.
Example fix
// before
new Mastra({ storage: new LegacyCustomStore() }); // memory: { observationalMemory: { enabled: true } }
// after
new Mastra({ storage: new PostgresStore({ connectionString: url }) }); // implements observational memory Defensive patterns
Strategy: fallback
Validate before calling
// capability probe before relying on observational memory
async function hasObservationalMemory(storage: MastraStorage) {
try { await storage.getObservationalMemory(null, '__probe__'); return true; }
catch (e) { return !String((e as Error).message).includes('Observational memory is not implemented'); }
} Type guard
function supportsObservationalMemory(s: unknown): boolean {
const proto = Object.getPrototypeOf(s);
return Object.getPrototypeOf(proto) && 'initializeObservationalMemory' in proto &&
(s as any).constructor.name !== 'MastraStorage';
} Try / catch
let record: ObservationalMemoryRecord | null = null;
try {
record = await storage.getObservationalMemory(threadId, resourceId);
} catch (e) {
if (String((e as Error).message).includes('Observational memory is not implemented')) {
record = null; // feature unsupported; degrade gracefully
} else throw e;
} Prevention
- Check the adapter's documented observational-memory support before enabling the feature.
- Pin adapter versions in package.json so an upgrade doesn't silently drop support.
- Wrap observational-memory reads in a capability check util used everywhere.
When it happens
Trigger: Calling getObservationalMemory(threadId, resourceId) — directly or via Memory with observational memory enabled — on an adapter that has no observational-memory overrides.
Common situations: Enabling observational memory in Memory config while using a storage adapter (e.g. older LibSQL, Upstash, or custom adapter) that hasn't implemented it; upgrading core but not the adapter package.
Related errors
- Resource-scoped message listing is not implemented by this s
- Observational memory record not found: ${id}
- No observational memory record found for thread ${ids.thread
- Subconscious curate requires a configured knowledge storage
- Subconscious learn requires a configured knowledge storage d
AI-assisted analysis of mastra-ai/mastra@75dd419e61 (2026-08-30).
Data as JSON: /api/errors/e89185ec47d35f63.
Report an issue: GitHub.