mastra-ai/mastra · error
Resource-scoped message listing is not implemented by this s
Error message
Resource-scoped message listing is not implemented by this storage adapter (${this.constructor.name}). Use an adapter that supports Observational Memory (pg, libsql, mongodb, convex) or disable observational memory. What it means
The base MemoryDomain storage class provides a default listMessagesByResourceId that always throws, because resource-scoped message listing (used by Observational Memory and LongMemEval) must be implemented by the concrete adapter. Only pg, libsql, mongodb, and convex support it.
Source
Thrown at packages/core/src/storage/domains/memory/base.ts:142
id,
...(title !== undefined ? { title } : {}),
...(metadata !== undefined ? { metadata } : {}),
});
}
abstract deleteThread({ threadId }: { threadId: string }): Promise<void>;
abstract listMessages(args: StorageListMessagesInput): Promise<StorageListMessagesOutput>;
/**
* List messages by resource ID only (across all threads).
* Used by Observational Memory and LongMemEval for resource-scoped queries.
*
* @param args - Resource ID and pagination/filtering options
* @returns Paginated list of messages for the resource
*/
async listMessagesByResourceId(_args: StorageListMessagesByResourceIdInput): Promise<StorageListMessagesOutput> {
throw new Error(
`Resource-scoped message listing is not implemented by this storage adapter (${this.constructor.name}). ` +
`Use an adapter that supports Observational Memory (pg, libsql, mongodb, convex) or disable observational memory.`,
);
}
abstract listMessagesById({ messageIds }: { messageIds: string[] }): Promise<{ messages: MastraDBMessage[] }>;
abstract saveMessages(args: { messages: MastraDBMessage[] }): Promise<{ messages: MastraDBMessage[] }>;
abstract updateMessages(args: {
messages: (Partial<Omit<MastraDBMessage, 'createdAt'>> & {
id: string;
content?: { metadata?: MastraMessageContentV2['metadata']; content?: MastraMessageContentV2['content'] };
})[];
}): Promise<MastraDBMessage[]>;
async deleteMessages(_messageIds: string[]): Promise<void> {
throw new Error(View on GitHub (pinned to 75dd419e61)
Solutions
- Switch to pg, libsql, mongodb, or convex storage
- Disable observational memory in your Mastra config if resource-scoped listing isn't needed
- Implement listMessagesByResourceId in your custom adapter
- Query messages per-thread instead of per-resource
Example fix
// before
new Mastra({ storage: new InMemoryStore(), /* observational memory enabled */ });
// after
new Mastra({ storage: new LibSQLStore({ url: 'file:./mastra.db' }), /* observational memory works */ }); Defensive patterns
Strategy: fallback
Validate before calling
function supportsResourceMessages(storage: unknown): boolean {
return typeof (storage as any)?.listMessagesByResourceId === 'function' &&
(storage as any).listMessagesByResourceId !== (MastraStorage.prototype as any).listMessagesByResourceId;
} Type guard
function canListByResource(s: unknown): s is { listMessagesByResourceId(a: StorageListMessagesByResourceIdInput): Promise<StorageListMessagesOutput> } {
return supportsResourceMessages(s);
} Try / catch
try {
return await storage.listMessagesByResourceId({ resourceId });
} catch (e) {
if (e instanceof Error && e.message.includes('Resource-scoped message listing is not implemented')) {
// fallback: aggregate messages across the resource's threads
return listMessagesAcrossThreads(resourceId);
}
throw e;
} Prevention
- Check adapter capability before enabling Observational Memory
- Prefer pg/libsql/mongodb/convex storage for resource-scoped features
- Probe optional methods at app startup rather than mid-request
When it happens
Trigger: Using Observational Memory or resource-scoped message queries with a storage adapter that does not override listMessagesByResourceId, e.g. an in-memory store or a minimal custom adapter.
Common situations: Enabling observational memory without switching from the default/in-memory storage; swapping storage backends in dev; writing a custom adapter and missing this optional method.
Related errors
- Message deletion is not supported by this storage adapter ($
- Thread cloning is not implemented by this storage adapter ($
- Resource working memory is not implemented by this storage a
- Observational memory is not implemented by this storage adap
- Observational memory record not found: ${id}
AI-assisted analysis of mastra-ai/mastra@75dd419e61 (2026-08-30).
Data as JSON: /api/errors/bdd39fe1fc0d4efa.
Report an issue: GitHub.