mastra-ai/mastra · error
No observational memory record found for thread ${ids.thread
Error message
No observational memory record found for thread ${ids.threadId} What it means
This error comes from the ObservationalMemory config-override path: it loads the existing observational memory record via `storage.getObservationalMemory(threadId, resourceId)` before writing `_overrides` config onto it. If no record exists for that thread (the thread was never processed by ObservationalMemory, or the ids are wrong), there is nothing to update, so it throws `No observational memory record found for thread <id>`.
Source
Thrown at packages/memory/src/processors/observational-memory/observational-memory.ts:4018
* to the instance-level config.
*
* @example
* ```ts
* await om.updateRecordConfig('thread-1', undefined, {
* observation: { messageTokens: 2000 },
* reflection: { observationTokens: 8000 },
* });
* ```
*/
async updateRecordConfig(
threadId: string,
resourceId: string | undefined,
config: Record<string, unknown>,
): Promise<void> {
const ids = this.getStorageIds(threadId, resourceId);
const record = await this.storage.getObservationalMemory(ids.threadId, ids.resourceId);
if (!record) {
throw new Error(`No observational memory record found for thread ${ids.threadId}`);
}
// Write under _overrides so getEffectiveMessageTokens / getEffectiveReflectionTokens
// pick up the override values, distinct from the initial config snapshot.
await this.storage.updateObservationalMemoryConfig({
id: record.id,
config: { _overrides: config },
});
}
/**
* Get observation history (previous generations)
*/
async getHistory(
threadId: string,
resourceId?: string,
limit?: number,
options?: ObservationalMemoryHistoryOptions,
): Promise<ObservationalMemoryRecord[]> {View on GitHub (pinned to 75dd419e61)
Solutions
- Run the thread through the agent/ObservationalMemory at least once so the record is created, then apply the config override.
- Verify the threadId (and resourceId) match the ones used when the record was created.
- Confirm you are reading/writing the same storage backend where the OM record lives.
- Add a pre-check via getObservationalMemory(threadId, resourceId) and handle the missing-record case gracefully instead of updating blindly.
Example fix
// before
await memory.updateObservationalMemoryConfig(threadId, resourceId, config); // throws if record missing
// after
const record = await memory.getObservationalMemory(threadId, resourceId);
if (record) {
await memory.updateObservationalMemoryConfig(threadId, resourceId, config);
} Defensive patterns
Strategy: try-catch
Validate before calling
const record = await storage.getObservationalMemory(threadId, resourceId);
if (!record) {
throw new Error(`Cannot update OM config: no record for thread ${threadId}. Run the thread through the agent first.`);
} Try / catch
try {
await memory.updateObservationalMemoryConfig(threadId, resourceId, config);
} catch (e) {
if (e instanceof Error && e.message.startsWith('No observational memory record found for thread')) {
// record not created yet: initialize by running the thread once, or skip
return; // or bootstrap the record
}
throw e;
} Prevention
- Only update OM config for threads that have completed at least one OM processing run.
- Pre-check getObservationalMemory(threadId, resourceId) before updating.
- Double-check threadId/resourceId values against stored records (avoid typos and cross-environment ids).
- Ensure all services point at the same storage backend instance.
When it happens
Trigger: Calling the config-update/updateObservationalMemoryConfig path (e.g. `memory.updateObservationalMemoryConfig(...)` or equivalent API) with a threadId that has no stored OM record — typically a brand-new thread or a typo'd id (observational-memory.ts:4018).
Common situations: Updating OM config for a thread created but never used with the agent; pointing at a different storage backend than the one that holds the record; resourceId mismatch so the composite lookup misses; race where the update call lands before the first OM processing run created the record.
Understand the failure class
Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.
Related errors
- Observational memory record not found: ${id}
- Version-control repository not found.
- Project repository not found for this organization.
- Source-control connection not found for this organization.
- Repository not found for this organization.
AI-assisted analysis of mastra-ai/mastra@75dd419e61 (2026-08-30).
Data as JSON: /api/errors/e899a6c1ee031a0a.
Report an issue: GitHub.