{"record":{"id":"a4fbc5eb44faca56","repo":"mihomo-party-org/clash-party","slug":"profileupdater-failed-to-audit-plugin-vault-it","errorCode":null,"errorMessage":"[ProfileUpdater] Failed to audit plugin vault ${item.pluginId}:","messagePattern":"\\[ProfileUpdater\\] Failed to audit plugin vault (.+?):","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/main/core/profileUpdater.ts","lineNumber":57,"sourceCode":"      // 动态 import 避免与 window.ts 形成静态循环依赖\n      const { mainWindow } = await import('../window')\n      mainWindow?.webContents.send('profileConfigUpdated')\n    } else if (item && item.type === 'plugin' && item.pluginId) {\n      const { updatePluginProfile } = await import('../resolve/plugin')\n      await updatePluginProfile(item.pluginId)\n    }\n  } finally {\n    updatingProfileIds.delete(id)\n  }\n}\n\nasync function auditPluginProfileVault(item: IProfileItem): Promise<void> {\n  if (item.type !== 'plugin' || !item.pluginId) return\n  try {\n    const { auditPluginVault } = await import('../resolve/plugin')\n    await auditPluginVault(item.pluginId)\n  } catch (e) {\n    await logger.warn(`[ProfileUpdater] Failed to audit plugin vault ${item.pluginId}:`, e)\n  }\n}\n\nfunction updateTask(itemId: string, logLabel: string): () => Promise<void> {\n  return async () => {\n    try {\n      await updateProfile(itemId)\n    } catch (e) {\n      await logger.warn(`[ProfileUpdater] Failed to update ${logLabel}:`, e)\n    }\n  }\n}\n\nfunction scheduleProfileUpdate(item: IProfileItem): void {\n  if ((item.type !== 'remote' && item.type !== 'plugin') || !item.autoUpdate || !item.interval)\n    return\n\n  const itemId = item.id","sourceCodeStart":39,"sourceCodeEnd":75,"githubUrl":"https://github.com/mihomo-party-org/clash-party/blob/911e090537acdf7c50bee1c3aebecc2ef119a8b5/src/main/core/profileUpdater.ts#L39-L75","documentation":"auditPluginProfileVault wraps auditPluginVault(item.pluginId) (dynamically imported from ../resolve/plugin) in try/catch and logs this warning on any rejection. The profile item of type 'plugin' still gets processed; only the security/integrity audit of its plugin vault did not run.","triggerScenarios":"addProfileUpdater / initProfileUpdater encounters a profile item with type==='plugin' and a pluginId, and auditPluginVault rejects — e.g. the plugin module fails to import, the vault files are missing/corrupt, or the plugin id no longer exists in the store.","commonSituations":"Plugin deleted or renamed on disk while profile entries still reference its id; corrupted plugin vault after an app update; dynamic import blocked by packaging (asar) issues in built binaries.","solutions":["Inspect the logged error `e` to see whether the import or the audit failed, and fix the underlying plugin/vault state.","Reinstall or re-import the plugin so its vault exists and matches item.pluginId.","If the plugin is obsolete, remove the stale plugin-type profile item so the audit is skipped legitimately (the guard returns early only when type!=='plugin' or pluginId is empty)."],"exampleFix":"// before\nawait auditPluginVault(item.pluginId)\n// after\nconst exists = await pluginStore.has(item.pluginId)\nif (!exists) {\n  logger.warn(`Skipping audit; plugin ${item.pluginId} missing from store`)\n  return\n}\nawait auditPluginVault(item.pluginId)","handlingStrategy":"try-catch","validationCode":"if (item.type !== 'plugin' || !item.pluginId) return\nif (!(await pluginStore.has(item.pluginId))) {\n  logger.warn(`plugin ${item.pluginId} missing; skipping audit`)\n  return\n}","typeGuard":"const isPluginItem = (i: IProfileItem): i is IProfileItem & { type: 'plugin'; pluginId: string } =>\n  i.type === 'plugin' && typeof i.pluginId === 'string' && i.pluginId.length > 0","tryCatchPattern":"try {\n  const { auditPluginVault } = await import('../resolve/plugin')\n  await auditPluginVault(item.pluginId)\n} catch (e) {\n  logger.warn(`[ProfileUpdater] Failed to audit plugin vault ${item.pluginId}:`, e)\n}","preventionTips":["Clean up plugin-type profile items when their plugin is uninstalled.","Verify plugin vault integrity after app updates or migrations.","Confirm dynamic imports resolve in packaged builds (asar/bundling config)."],"tags":["plugin","vault","audit","profile-updater"],"backgroundTag":"plugin-vault-audit-failed","analyzedSha":"911e090537acdf7c50bee1c3aebecc2ef119a8b5","analyzedAt":"2026-08-30T13:00:49.174Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}