linshenkx/prompt-optimizer · error · FavoriteStorageError
Failed to delete favorite prompt asset version: ${errorMessa
Error message
Failed to delete favorite prompt asset version: ${errorMessage} What it means
Wrapped FavoriteStorageError thrown when an unexpected (non-FavoriteError) exception escapes deleteFavoritePromptAssetVersion — typically a storage failure in the underlying storageProvider (read/parse/write of favorites data). Known domain errors like FavoriteNotFoundError/FavoriteValidationError are rethrown untouched; everything else is wrapped with the original message for context.
Source
Thrown at packages/core/src/services/favorite/manager.ts:582
},
};
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 delete favorite prompt asset version: ${errorMessage}`);
}
}
async deleteFavorite(id: 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);
}
return favoritesList.filter(f => f.id !== id);
});
await this.updateStats();View on GitHub (pinned to 3e677b1d9f)
Solutions
- Inspect error.message / inner cause to identify the underlying storage failure
- Clear or repair the corrupted favorites entry in storage (re-export/import a known-good copy)
- Reduce stored payload size (prune old versions/favorites) if quota is the issue
- If using a custom storageProvider, verify its updateData contract and error behavior
Defensive patterns
Strategy: try-catch
Type guard
const isFavoriteStorageError = (e: unknown): e is FavoriteStorageError => e instanceof FavoriteStorageError;
Try / catch
try { await manager.deleteFavoritePromptAssetVersion(id, vId); } catch (e) { if (e instanceof FavoriteStorageError) { /* inspect e.message for underlying storage cause; possibly retry */ } else throw e; } Prevention
- Keep stored favorites payload small (prune old versions)
- Verify storage availability before mutating
- Back up/export favorites before bulk operations
When it happens
Trigger: storageProvider.updateData or getFavorite throwing a low-level error during the delete flow: corrupted JSON in storage, quota exceeded, backend/network failure of a remote storage provider, or a serialization bug in the prompt asset metadata.
Common situations: localStorage quota exceeded in browsers with large prompt assets; remote sync storage offline; corrupted persisted JSON after a partial write or version migration; storage disabled in privacy modes.
Related errors
- Failed to get category usage: ${errorMessage}
- Failed to add category: ${errorMessage}
- Failed to update category: ${errorMessage}
- Failed to delete category: ${errorMessage}
- Failed to get statistics: ${errorMessage}
AI-assisted analysis of linshenkx/prompt-optimizer@3e677b1d9f (2026-08-27).
Data as JSON: /api/errors/d4d612c0a19990de.
Report an issue: GitHub.