mastra-ai/mastra · critical · HTTPException
Favorites storage domain is not available
Error message
Favorites storage domain is not available
What it means
getFavoritesContext resolves the storage adapter's 'skills' and 'favorites' domains for the stored-skill favorites routes. When mastra.getStorage() exists but storage.getStore('favorites') returns nothing, the server cannot read or write favorites and throws this HTTPException with status 500. It is a server-side configuration/deployment problem, not a client mistake: the favorites storage domain was never registered or failed to initialize.
Source
Thrown at packages/server/src/server/handlers/stored-skill-favorites.ts:25
import { assertReadAccess, getCallerAuthorId } from './authorship';
import { requireBuilderFeature } from './editor-builder';
import { handleError } from './error';
/**
* Resolves the storage and favorites domains, throwing 500 if unavailable.
*/
async function getFavoritesContext(mastra: Parameters<typeof requireBuilderFeature>[0]) {
const storage = mastra.getStorage();
if (!storage) {
throw new HTTPException(500, { message: 'Storage is not configured' });
}
const skillStore = await storage.getStore('skills');
if (!skillStore) {
throw new HTTPException(500, { message: 'Skills storage domain is not available' });
}
const favoritesStore = await storage.getStore('favorites');
if (!favoritesStore) {
throw new HTTPException(500, { message: 'Favorites storage domain is not available' });
}
return { skillStore, favoritesStore };
}
/**
* PUT /stored/skills/:storedSkillId/favorite
*/
export const FAVORITE_STORED_SKILL_ROUTE = createRoute({
method: 'PUT',
path: '/stored/skills/:storedSkillId/favorite',
responseType: 'json',
pathParamSchema: storedSkillIdPathParams,
responseSchema: favoriteToggleResponseSchema,
summary: 'Favorite a stored skill',
description: 'Marks the stored skill as favorited by the calling user. Idempotent.',
tags: ['Stored Skills'],
requiresAuth: true,
requiresPermission: 'stored-skills:read',View on GitHub (pinned to 75dd419e61)
Solutions
- Configure a storage adapter that implements the favorites domain (e.g. current @mastra/libsql or @mastra/pg) in new Mastra({...storage})
- Run the storage schema setup/migrations so the favorites tables exist for the configured backend
- Verify storage.getStore('favorites') returns a store in a small script against your deployed storage config
- If using a custom storage class, implement and register the favorites store in getStore()
Example fix
// before
new Mastra({ storage: new InMemoryStorage() });
// after
import { LibSQLStore } from '@mastra/libsql';
new Mastra({ storage: new LibSQLStore({ url: process.env.DATABASE_URL }) }); Defensive patterns
Strategy: fallback
Validate before calling
const storage = mastra.getStorage();
const favoritesStore = storage ? await storage.getStore('favorites') : undefined;
if (!favoritesStore) {
console.warn('Favorites domain unavailable; hiding favorites UI');
} Type guard
function hasFavoritesDomain(s: unknown): s is { getStore(d: 'favorites'): Promise<unknown> } {
return !!s && typeof (s as any).getStore === 'function';
} Try / catch
try {
await api.put(`/stored/skills/${id}/favorite`);
} catch (e) {
if (isHttpError(e) && e.status === 500 && /Favorites storage domain/.test(e.message)) {
disableFavoritesFeature(); // degrade gracefully
} else throw e;
} Prevention
- Pin a storage adapter that explicitly supports the favorites domain
- Add a boot-time health check asserting getStore('skills') and getStore('favorites') both resolve
- Keep @mastra/core and storage package versions aligned
When it happens
Trigger: Any request to PUT or DELETE /stored/skills/:storedSkillId/favorite (or the favorites-filter path of the stored-skills list) when the configured storage adapter does not expose a 'favorites' store — e.g. getStore('favorites') resolves to undefined because the storage class doesn't implement the favorites domain or wasn't registered.
Common situations: Running with a storage backend (in-memory, older LibSQL/Pg config, custom adapter) that predates the favorites domain; a custom MastraStorage implementation missing the favorites store; connecting to a database whose schema/migrations for favorites were never applied; swapping storage config in one environment but not another.
Related errors
- Storage is not configured
- Favorites storage domain is not available
- AcpAgent does not support resuming suspended generate calls
- ACP prompt stopped before completing: ${response.stopReason}
- Agents storage domain is not available
AI-assisted analysis of mastra-ai/mastra@75dd419e61 (2026-08-30).
Data as JSON: /api/errors/d8c531d574342968.
Report an issue: GitHub.