linshenkx/prompt-optimizer · error · FavoriteStorageError
Failed to set favorite prompt asset current version: ${error
Error message
Failed to set favorite prompt asset current version: ${errorMessage} What it means
Catch-all FavoriteStorageError from setFavoritePromptAssetCurrentVersion wrapping any unexpected non-FavoriteError failure during the transactional update or the subsequent stats update.
Source
Thrown at packages/core/src/services/favorite/manager.ts:522
},
};
assertFavoriteFitsItemBudget(nextFavorite);
favoritesList[index] = nextFavorite;
assertFavoritesPayloadWithinBudget(favoritesList, {
warnOnSoftLimit: true,
});
return favoritesList;
});
await this.updateStats();
} catch (error) {
if (error instanceof FavoriteError) {
throw error;
}
const errorMessage = error instanceof Error ? error.message : String(error);
throw new FavoriteStorageError(`Failed to set favorite prompt asset current version: ${errorMessage}`);
}
}
async deleteFavoritePromptAssetVersion(id: string, versionId: string): Promise<void> {
await this.ensureInitialized();
try {
await this.storageProvider.updateData(this.STORAGE_KEYS.FAVORITES, (favorites: FavoritePrompt[] | null) => {
const favoritesList = favorites || [];
const index = favoritesList.findIndex(f => f.id === id);
if (index === -1) {
throw new FavoriteNotFoundError(id);
}
const currentFavorite = favoritesList[index];
const metadata = currentFavorite.metadata && typeof currentFavorite.metadata === 'object'
? { ...currentFavorite.metadata }
: {};View on GitHub (pinned to 3e677b1d9f)
Solutions
- Check the appended errorMessage for the storage root cause
- Verify writability and initialization of the storage provider
- Retry after resolving transient storage contention
Defensive patterns
Strategy: try-catch
Try / catch
try { await manager.setFavoritePromptAssetCurrentVersion(id, versionId); }
catch (e) {
if (e instanceof FavoriteStorageError) { /* surface storage failure */ }
else throw e;
} Prevention
- Ensure storage is initialized and writable before version switches
- Back up favorites storage before batch version operations
When it happens
Trigger: storageProvider.updateData or updateStats throwing (write failure, permissions, quota, serialization) during a version switch.
Common situations: Backing store unwritable or locked; interrupted write leaving the store inconsistent; custom provider throwing raw errors.
Related errors
- Failed to update favorite: ${errorMessage}
- Failed to get favorite details: ${errorMessage}
- STORAGE_ERROR
- TAG_ERROR
- error.message || ''
AI-assisted analysis of linshenkx/prompt-optimizer@3e677b1d9f (2026-08-27).
Data as JSON: /api/errors/4c2fdb7e29aca9e2.
Report an issue: GitHub.