{"record":{"id":"6c275d6f213f8911","repo":"mihomo-party-org/clash-party","slug":"profileupdater-failed-to-init-current-profile","errorCode":null,"errorMessage":"[ProfileUpdater] Failed to init current profile:","messagePattern":"\\[ProfileUpdater\\] Failed to init current profile:","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/main/core/profileUpdater.ts","lineNumber":149,"sourceCode":"      }\n    }\n\n    if (item.type === 'plugin' && item.autoUpdate && item.interval) {\n      await addProfileUpdater(item)\n    }\n  }\n\n  await auditPluginProfileVault(currentItem)\n\n  if (currentItem?.type === 'remote' && currentItem.autoUpdate && currentItem.interval) {\n    const currentId = currentItem.id\n    await addProfileUpdater(currentItem)\n\n    if (autoUpdateProfileOnStart) {\n      try {\n        await addProfileItem(currentItem)\n      } catch (e) {\n        await logger.warn(`[ProfileUpdater] Failed to init current profile:`, e)\n      }\n    }\n\n    const latestCurrentItem = (await getProfileItem(currentId)) ?? currentItem\n    scheduleDelayedCurrentUpdate(latestCurrentItem)\n  }\n\n  if (\n    currentItem?.type === 'plugin' &&\n    currentItem.autoUpdate &&\n    currentItem.interval &&\n    currentItem.id !== 'default'\n  ) {\n    await addProfileUpdater(currentItem)\n  }\n}\n\nexport async function addProfileUpdater(item: IProfileItem): Promise<void> {","sourceCodeStart":131,"sourceCodeEnd":167,"githubUrl":"https://github.com/mihomo-party-org/clash-party/blob/911e090537acdf7c50bee1c3aebecc2ef119a8b5/src/main/core/profileUpdater.ts#L131-L167","documentation":"The second half of initProfileUpdater performs the same on-start refresh for the currently selected profile (currentId): addProfileItem(currentItem) is wrapped in try/catch that logs this warning on failure. Afterwards the code still fetches the latest item and schedules scheduleDelayedCurrentUpdate, so a delayed retry path exists; this warning only means the immediate refresh failed.","triggerScenarios":"Startup with autoUpdateProfileOnStart enabled and addProfileItem(currentItem) rejects — network not ready yet, subscription endpoint error, or the current profile item is corrupt/missing required fields.","commonSituations":"App autostarts with the OS before network interfaces are up; the selected subscription returns an error right after boot; currentId points to a deleted/migrated profile item after an app data restore.","solutions":["Rely on the subsequent scheduleDelayedCurrentUpdate which retries shortly after — verify the delayed update succeeds.","Check the current profile's URL and item integrity (getProfileItem(currentId)) and re-import if fields are missing.","Ensure network is available at startup (delay autoUpdateProfileOnStart or gate it on connectivity)."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"const currentItem = await getProfileItem(currentId)\nif (!currentItem) {\n  logger.warn('current profile missing; selecting first available')\n  return\n}","typeGuard":null,"tryCatchPattern":"try {\n  await addProfileItem(currentItem)\n} catch (e) {\n  logger.warn('[ProfileUpdater] Failed to init current profile:', e)\n  // scheduleDelayedCurrentUpdate below already provides a retry path\n}","preventionTips":["Rely on the built-in scheduleDelayedCurrentUpdate as the retry; ensure it always runs even after failure.","Verify currentId resolves to an existing item after data restores or migrations.","On autostart, wait for network-ready events before enabling autoUpdateProfileOnStart work."],"tags":["profile-update","startup","current-profile","network"],"backgroundTag":"profile-update-failed","analyzedSha":"911e090537acdf7c50bee1c3aebecc2ef119a8b5","analyzedAt":"2026-08-30T13:00:49.174Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}