mastra-ai/mastra · error · Error
The workingMemory.use option has been removed. Working memor
Error message
The workingMemory.use option has been removed. Working memory always uses tool-call mode.
What it means
The workingMemory.use option ('tool-call' vs 'metadata' modes) was removed; working memory now always operates in tool-call mode. getMergedThreadConfig throws this Error whenever a MemoryConfig contains a workingMemory object with a `use` key, so stale configs fail loudly instead of being silently ignored.
Source
Thrown at packages/core/src/memory/memory.ts:384
// Only PG vector store will use these parameters
if (indexConfig && (indexConfig.type || indexConfig.ivf || indexConfig.hnsw)) {
createParams.indexConfig = {};
if (indexConfig.type) createParams.indexConfig.type = indexConfig.type;
if (indexConfig.ivf) createParams.indexConfig.ivf = indexConfig.ivf;
if (indexConfig.hnsw) createParams.indexConfig.hnsw = indexConfig.hnsw;
}
// Request btree indexes on metadata fields used for filtering
// This avoids sequential scans on large tables when querying by thread_id or resource_id
createParams.metadataIndexes = ['thread_id', 'resource_id'];
await this.vector.createIndex(createParams);
return { indexName };
}
public getMergedThreadConfig(config?: MemoryConfigInternal): MemoryConfigInternal {
if (config?.workingMemory && typeof config.workingMemory === 'object' && 'use' in config.workingMemory) {
throw new Error('The workingMemory.use option has been removed. Working memory always uses tool-call mode.');
}
if (config?.threads?.generateTitle !== undefined) {
throw new Error(
'The threads.generateTitle option has been moved. Use the top-level generateTitle option instead.',
);
}
const mergedConfig = deepMerge(this.threadConfig, config || {});
if (
typeof config?.workingMemory === 'object' &&
config.workingMemory?.schema &&
typeof mergedConfig.workingMemory === 'object'
) {
mergedConfig.workingMemory.schema = config.workingMemory.schema;
}
View on GitHub (pinned to 75dd419e61)
Solutions
- Delete the `use` property from the workingMemory object in your Memory options.
- Keep other workingMemory settings (template, useStateSignals) that remain supported.
- Search your codebase for 'use:' inside workingMemory config blocks after upgrading.
Example fix
// before
options: { workingMemory: { use: 'tool-call', template: 'User name: {{name}}' } }
// after
options: { workingMemory: { template: 'User name: {{name}}' } } Defensive patterns
Strategy: validation
Validate before calling
function assertNoWorkingMemoryUse(options) {
const wm = options?.workingMemory;
if (wm && typeof wm === 'object' && 'use' in wm) throw new Error('Remove workingMemory.use; tool-call mode is always used');
} Type guard
function isModernWorkingMemory(wm) {
return wm === undefined || typeof wm === 'string' || (typeof wm === 'object' && wm !== null && !('use' in wm));
} Prevention
- After upgrading, grep for workingMemory blocks containing 'use:'.
- Type Memory options with a type that omits `use` so TS catches it.
- Keep memory options in a single typed constants file.
When it happens
Trigger: Passing options like { workingMemory: { use: 'tool-call', template: '...' } } into Memory options, thread config, or getMergedThreadConfig.
Common situations: Upgrading from an older Mastra version where workingMemory.use was valid; copy-pasting blog posts or old docs examples; generated config code still emitting the deprecated field.
Related errors
- The 'processors' option in Memory is deprecated and has been
- The threads.generateTitle option has been moved. Use the top
- toAISdkFormat() has been deprecated. Please use toAISdkStrea
- addMessage is deprecated. Please use saveMessages instead.
- WORKING_MEMORY_MISSING_STORAGE_ADAPTER
AI-assisted analysis of mastra-ai/mastra@75dd419e61 (2026-08-30).
Data as JSON: /api/errors/4c6eb251695a285c.
Report an issue: GitHub.