mastra-ai/mastra · critical · HTTPException
Storage is not configured
Error message
Storage is not configured
What it means
Thrown by getFavoritesContext in stored-skill-favorites.ts when `mastra.getStorage()` returns falsy. The stored-skill favorite/unfavorite routes (PUT/DELETE /stored/skills/:id/favorite) need both the skills and favorites storage domains, so they fail fast with HTTP 500 when no storage is configured on the Mastra instance.
Source
Thrown at packages/server/src/server/handlers/stored-skill-favorites.ts:17
import { HTTPException } from '../http-exception';
import { favoriteToggleResponseSchema } from '../schemas/favorites';
import { storedSkillIdPathParams } from '../schemas/stored-skills';
import { createRoute } from '../server-adapter/routes/route-builder';
import { assertStoredResourceScope, getStoredResourceScope } from '../utils';
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',View on GitHub (pinned to 75dd419e61)
Solutions
- Configure storage on the Mastra instance so `getStorage()` returns a store (Postgres/LibSQL/other official adapter).
- Audit all code paths that construct Mastra (dev vs prod configs) to ensure the storage option is always present.
- If favorites aren't needed, disable the builder favorites feature so these routes aren't exposed/called.
- Add a startup check that logs/fails fast if a feature requiring storage is enabled without storage.
Example fix
// before
export const mastra = new Mastra({ agents: myAgents });
// after
export const mastra = new Mastra({
agents: myAgents,
storage: new LibSQLStore({ url: process.env.LIBSQL_URL }),
}); Defensive patterns
Strategy: try-catch
Validate before calling
// server-side guard before enabling favorites
if (favoritesEnabled && !mastra.getStorage()) {
throw new Error('Favorites feature requires storage; configure Mastra storage or disable favorites');
} Type guard
function storageIsConfigured(mastra: { getStorage(): unknown }): mastra is { getStorage(): NonNullable<ReturnType<typeof mastra.getStorage>> } {
return !!mastra.getStorage();
} Try / catch
try {
const res = await fetch(`/api/stored/skills/${id}/favorite`, { method: 'PUT' });
if (res.status === 500) {
const body = await res.json().catch(() => ({}));
if (body?.message === 'Storage is not configured') {
console.error('Favorites require server storage — configure Mastra storage');
return;
}
}
} catch (err) {
console.error('Favorite toggle failed:', err);
} Prevention
- Never enable the builder favorites feature without also configuring storage.
- Use one Mastra factory for all environments so storage can't be omitted accidentally.
- Add an integration test that hits a favorites route against the real server config.
- Fail fast at boot if required features are enabled but storage is missing.
When it happens
Trigger: Calling PUT or DELETE /api/stored/skills/:storedSkillId/favorite on a server whose Mastra instance has no storage configured — getFavoritesContext throws before resolving skillStore/favoritesStore (both agentStore and favoritesStore callers are affected).
Common situations: Mastra app deployed without a storage adapter; favorites feature enabled (requireBuilderFeature 'favorites' passes) but storage never wired; local dev runs fine in-memory, then production calls favorites endpoints and 500s; config refactor accidentally drops the `storage` option.
Related errors
- AcpAgent does not support resuming suspended generate calls
- ACP prompt stopped before completing: ${response.stopReason}
- Storage is not configured
- Favorites storage domain is not available
- Favorites storage domain is not available
AI-assisted analysis of mastra-ai/mastra@75dd419e61 (2026-08-30).
Data as JSON: /api/errors/ea6d463b2f6e54ee.
Report an issue: GitHub.