linshenkx/prompt-optimizer · error · FavoriteTagNotFoundError
Tag not found: ${error.tag || ''}
Error message
Tag not found: ${error.tag || ''} What it means
Main process returned TAG_NOT_FOUND; the proxy throws FavoriteTagNotFoundError with the tag name. The referenced tag does not exist in the tag store. (Note: the literal message in this code path is the tag name itself; the prefixed 'Tag not found:' form is the canonical message of FavoriteTagNotFoundError.)
Source
Thrown at packages/core/src/services/favorite/electron-proxy.ts:76
if (error.code === 'CATEGORY_NOT_FOUND') {
throw new FavoriteCategoryNotFoundError(error.id || '');
}
if (error.code === 'VALIDATION_ERROR') {
throw new FavoriteValidationError(error.message || '');
}
if (error.code === 'STORAGE_ERROR') {
throw new FavoriteStorageError(error.message || '');
}
// Legacy: category already exists
if (error.code === 'CATEGORY_ALREADY_EXISTS') {
throw new FavoriteValidationError(error.message || 'Category already exists')
}
// 标签相关错误
if (error.code === 'TAG_ALREADY_EXISTS') {
throw new FavoriteTagAlreadyExistsError(error.tag || '');
}
if (error.code === 'TAG_NOT_FOUND') {
throw new FavoriteTagNotFoundError(error.tag || '');
}
if (error.code === 'TAG_ERROR') {
throw new FavoriteTagError(FAVORITE_ERROR_CODES.TAG_ERROR, error.message || '', { details: error.message || '' });
}
// 数据迁移和导入导出错误
if (error.code === 'MIGRATION_ERROR') {
throw new FavoriteMigrationError(error.message || '', error.cause);
}
if (error.code === 'IMPORT_EXPORT_ERROR') {
throw new FavoriteImportExportError(error.message || '', error.cause, error.details);
}
// Fallback: preserve message as details for i18n-friendly error
throw new FavoriteError(FAVORITE_ERROR_CODES.STORAGE_ERROR, error.message || 'Unknown error', {
details: error.message || 'Unknown error',
});
}
}
View on GitHub (pinned to 3e677b1d9f)
Solutions
- Refresh the tag list and retry with a current tag
- Catch FavoriteTagNotFoundError and remove the stale tag from UI selection
- Reconcile tag state after any delete/import operation
Example fix
// before
await mgr.deleteTag(tag);
// after
try { await mgr.deleteTag(tag); }
catch (e) { if (e instanceof FavoriteTagNotFoundError) return; throw e; } Defensive patterns
Strategy: try-catch
Validate before calling
const current = await mgr.getTags(); const valid = current.some(t => t.name === tag);
Type guard
const isTagNotFound = (e: unknown): e is FavoriteTagNotFoundError => e instanceof FavoriteTagNotFoundError;
Try / catch
try { await mgr.deleteTag(tag); } catch (e) { if (isTagNotFound(e)) return; throw e; } Prevention
- Drop deleted tags from pickers immediately
- Reconcile tag state after import/migration
- Make tag removal idempotent
When it happens
Trigger: updateTag/deleteTag/assignTag operations referencing a tag that was deleted, via the Electron proxy.
Common situations: Stale tag list in UI after deletion elsewhere; tag removed during import/migration; race between tag picker refresh and delete.
Understand the failure class
Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.
Related errors
AI-assisted analysis of linshenkx/prompt-optimizer@3e677b1d9f (2026-08-27).
Data as JSON: /api/errors/d36a278c5be29016.
Report an issue: GitHub.