mastra-ai/mastra · error
Working memory is not enabled for this memory instance
Error message
Working memory is not enabled for this memory instance
What it means
updateWorkingMemory requires working memory to be enabled in the memory instance's configuration. The merged thread config is checked for workingMemory.enabled and the error is thrown immediately if disabled. It is a configuration precondition, not a data problem.
Source
Thrown at packages/memory/src/index.ts:1000
}
async updateWorkingMemory({
threadId,
resourceId,
workingMemory,
memoryConfig,
observabilityContext,
}: {
threadId: string;
resourceId?: string;
workingMemory: string;
memoryConfig?: MemoryConfigInternal;
observabilityContext?: Partial<ObservabilityContext>;
}): Promise<void> {
const config = this.getMergedThreadConfig(memoryConfig || {});
if (!config.workingMemory?.enabled) {
throw new Error('Working memory is not enabled for this memory instance');
}
const span = this.createMemorySpan(
'update',
observabilityContext,
{ threadId, resourceId },
{
workingMemoryEnabled: true,
},
);
try {
const scope = config.workingMemory.scope || 'resource';
// Guard: If resource-scoped working memory is enabled but no resourceId is provided, throw an error
if (scope === 'resource' && !resourceId) {
throw new Error(
`Memory error: Resource-scoped working memory is enabled but no resourceId was provided. ` +View on GitHub (pinned to 75dd419e61)
Solutions
- Enable working memory: new Memory({ ..., options: { workingMemory: { enabled: true } } })
- Enable it per-call by passing memoryConfig with workingMemory: { enabled: true } in thread options
- Remove the update-working-memory tool/agent step if working memory is not used
Example fix
// before
const memory = new Memory({ storage: store, embedder });
// after
const memory = new Memory({ storage: store, embedder, options: { workingMemory: { enabled: true, template: '...' } } }); Defensive patterns
Strategy: validation
Validate before calling
const cfg = getMergedThreadConfig(memoryConfig);
if (!cfg.workingMemory?.enabled) throw new Error('Enable workingMemory in Memory options before calling updateWorkingMemory'); Try / catch
try {
await memory.updateWorkingMemory(args);
} catch (e) {
if (e instanceof Error && e.message === 'Working memory is not enabled for this memory instance') {
// reconfigure Memory or skip the tool call
} else throw e;
} Prevention
- Register the update-working-memory tool only when workingMemory.enabled is true
- Keep workingMemory config in one shared Memory factory
- Test the tool flow after any Memory config change
When it happens
Trigger: Calling memory.updateWorkingMemory({ threadId, resourceId, workingMemory }) when no workingMemory config (or workingMemory: { enabled: false }) was set on the Memory instance or via the per-thread config.
Common situations: Adding the update-working-memory tool to an agent without enabling workingMemory in the Memory config; per-thread config overriding enabled to false; copying configs between projects.
Related errors
- WORKING_MEMORY_MISSING_STORAGE_ADAPTER
- workingMemory.useStateSignals is not supported with workingM
- Thread ID is required for thread-scoped working memory updat
- Resource ID is required for resource-scoped working memory u
- sendStateSignal requires Mastra memory
AI-assisted analysis of mastra-ai/mastra@75dd419e61 (2026-08-30).
Data as JSON: /api/errors/7bbd8bb80419153d.
Report an issue: GitHub.