{"record":{"id":"f1a188f3275b5265","repo":"mastra-ai/mastra","slug":"favorites-storage-domain-is-not-available-f1a188","errorCode":null,"errorMessage":"Favorites storage domain is not available","messagePattern":"Favorites storage domain is not available","errorType":"http","errorClass":"HTTPException","httpStatus":500,"severity":"critical","filePath":"packages/server/src/server/handlers/stored-skills.ts","lineNumber":171,"sourceCode":"      const scope = await getStoredResourceScope(mastra, requestContext);\n      const scopedMetadata = scopeStoredResourceMetadata(metadata, scope);\n\n      const callerId = getCallerAuthorId(requestContext);\n      const favoritesEnabled = await isBuilderFeatureEnabled(mastra, 'favorites');\n      const honoredStarredOnly = favoritesEnabled && favoritedOnly === true;\n      const favoriteSubjectId = pinFavoritedFor ?? callerId;\n\n      // `?favoritedOnly=true` flow: fetch caller's favorited IDs, restrict the list\n      // to that set, then post-filter by visibility and recompute total/pages.\n      if (honoredStarredOnly) {\n        const effectivePerPage: number = perPage ?? 100;\n        if (!favoriteSubjectId) {\n          // Caller cannot have favorited anything without an identity.\n          return { skills: [], total: 0, page, perPage: effectivePerPage, hasMore: false };\n        }\n        const favoritesStore = await storage.getStore('favorites');\n        if (!favoritesStore) {\n          throw new HTTPException(500, { message: 'Favorites storage domain is not available' });\n        }\n        const starredIds = await favoritesStore.listFavoritedIds({ userId: favoriteSubjectId, entityType: 'skill' });\n        if (starredIds.length === 0) {\n          return { skills: [], total: 0, page, perPage: effectivePerPage, hasMore: false };\n        }\n        const allMatching = await skillStore.listResolved({\n          perPage: false,\n          orderBy,\n          status,\n          authorId: filter.kind === 'exact' ? filter.authorId : undefined,\n          metadata: scopedMetadata,\n          entityIds: starredIds,\n        });\n        const visible = allMatching.skills.filter(record => matchesAuthorFilter(record, filter));\n        const total = visible.length;\n        const startIdx = effectivePerPage === 0 ? 0 : page * effectivePerPage;\n        const endIdx = effectivePerPage === 0 ? 0 : startIdx + effectivePerPage;\n        const sliced = effectivePerPage === 0 ? [] : visible.slice(startIdx, endIdx);","sourceCodeStart":153,"sourceCodeEnd":189,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/server/src/server/handlers/stored-skills.ts#L153-L189","documentation":"In the stored-skills list handler, when filtering by favorites (favoritedBy / favorite subject), it resolves the favorites store via storage.getStore('favorites'); if unavailable it throws HTTPException 500 'Favorites storage domain is not available'. This path only runs for favorites-filtered queries, so the error appears only when the request asks for skills the caller (or subject user) has favorited.","triggerScenarios":"GET /stored/skills with a favorites filter (e.g. favorited=true / favoritedBy subject) when the storage adapter doesn't provide a 'favorites' store; note the handler earlier returns an empty page instead if the subject id can't be resolved, so reaching this error means a subject was identified but the store is missing.","commonSituations":"Adapter without the favorites domain (in-memory or legacy/custom store); favorites tables not migrated; only some environments' storage configured with the favorites domain so the UI favorites tab fails there.","solutions":["Switch to a storage adapter implementing the favorites domain (current @mastra/libsql/@mastra/pg)","Apply the favorites schema/migrations on the target database","Pin matching versions of @mastra/core and the storage package so domain registration works","Guard the UI to disable the favorites filter until the backend supports it"],"exampleFix":"// before\nstorage: new MastraMemoryStorage(); // no favorites domain; favorites filter 500s\n\n// after\nstorage: new PgStore({ connectionString: process.env.DATABASE_URL }); // favorites domain included","handlingStrategy":"fallback","validationCode":"const storage = mastra.getStorage();\nif (!storage || !(await storage.getStore('favorites'))) {\n  // hide the favorites filter before issuing the query\n  disableFavoritesFilter();\n}","typeGuard":null,"tryCatchPattern":"try {\n  return await api.get('/stored/skills?favorited=true');\n} catch (e) {\n  if (isHttpError(e) && /Favorites storage domain/.test(e.message)) {\n    return { skills: [], total: 0, page, perPage, hasMore: false }; // degrade\n  }\n  throw e;\n}","preventionTips":["Gate favorites UI features on a capability check of the storage adapter","Apply favorites migrations in every environment","Include favorites-domain availability in deploy health checks"],"tags":["storage","favorites","server","configuration"],"backgroundTag":"storage-domain-unavailable","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}