mastra-ai/mastra · error

Resource working memory is not implemented by this storage a

Error message

Resource working memory is not implemented by this storage adapter (${this.constructor.name}). This is likely a bug - all Mastra storage adapters should implement resource support. Please report this issue at https://github.com/mastra-ai/mastra/issues

What it means

getResourceById's base-class default throws, and the message says this is likely a bug: per the framework contract, every storage adapter should implement resource (working memory) support. Hitting this means the loaded adapter subclass neither implements the method nor extends a base that does.

Source

Thrown at packages/core/src/storage/domains/memory/base.ts:192

   */
  abstract listThreads(args: StorageListThreadsInput): Promise<StorageListThreadsOutput>;

  /**
   * Clone a thread and its messages to create a new independent thread.
   * The cloned thread will have clone metadata stored in its metadata field.
   *
   * @param args - Clone configuration options
   * @returns The newly created thread and the cloned messages
   */
  async cloneThread(_args: StorageCloneThreadInput): Promise<StorageCloneThreadOutput> {
    throw new Error(
      `Thread cloning is not implemented by this storage adapter (${this.constructor.name}). ` +
        `The cloneThread method needs to be implemented in the storage adapter.`,
    );
  }

  async getResourceById(_: { resourceId: string }): Promise<StorageResourceType | null> {
    throw new Error(
      `Resource working memory is not implemented by this storage adapter (${this.constructor.name}). ` +
        `This is likely a bug - all Mastra storage adapters should implement resource support. ` +
        `Please report this issue at https://github.com/mastra-ai/mastra/issues`,
    );
  }

  async saveResource(_: { resource: StorageResourceType }): Promise<StorageResourceType> {
    throw new Error(
      `Resource working memory is not implemented by this storage adapter (${this.constructor.name}). ` +
        `This is likely a bug - all Mastra storage adapters should implement resource support. ` +
        `Please report this issue at https://github.com/mastra-ai/mastra/issues`,
    );
  }

  async updateResource(_: {
    resourceId: string;
    workingMemory?: string;
    metadata?: Record<string, unknown>;

View on GitHub (pinned to 75dd419e61)

Solutions

  1. Implement getResourceById in your adapter (return the resource row or null)
  2. Update the adapter package to a version that implements resource support
  3. File a bug with the official adapter per the linked issue tracker
  4. Bypass working-memory features if using a stub store

Example fix

// before
class MyStore extends MastraStorage { /* no getResourceById */ }
// after
async getResourceById({ resourceId }: { resourceId: string }): Promise<StorageResourceType | null> {
  return this.db.resources.get(resourceId) ?? null;
}
Defensive patterns

Strategy: try-catch

Validate before calling

function supportsResources(storage: unknown): boolean {
  return typeof (storage as any)?.getResourceById === 'function' &&
    (storage as any).getResourceById !== (MastraStorage.prototype as any).getResourceById;
}

Type guard

function canGetResource(s: unknown): s is { getResourceById(a: { resourceId: string }): Promise<StorageResourceType | null> } {
  return supportsResources(s);
}

Try / catch

try {
  return await storage.getResourceById({ resourceId });
} catch (e) {
  if (e instanceof Error && e.message.includes('Resource working memory is not implemented')) {
    logger.error('Storage adapter does not implement resources; update or fix the adapter');
    return null;
  }
  throw e;
}

Prevention

When it happens

Trigger: Any working-memory/resource lookup path calling getResourceById against an adapter whose class does not override it — most plausibly a custom or third-party adapter missing the implementation, or an adapter from an older core version.

Common situations: Hand-rolled storage adapters; adapters from older versions predating the resource domain; subclassing MastraStorage directly for a quick mock store.

Related errors


AI-assisted analysis of mastra-ai/mastra@75dd419e61 (2026-08-30). Data as JSON: /api/errors/796da40f8ad36aa0. Report an issue: GitHub.