{"record":{"id":"e40c3a36f71c0e4c","repo":"mihomo-party-org/clash-party","slug":"profileupdater-failed-to-update-current-profile","errorCode":null,"errorMessage":"[ProfileUpdater] Failed to update current profile:","messagePattern":"\\[ProfileUpdater\\] Failed to update current profile:","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/main/core/profileUpdater.ts","lineNumber":107,"sourceCode":"  try {\n    intervalPool[itemId] = new Cron(cronExpression, updateTask(itemId, logLabel))\n  } catch {\n    // ignore invalid cron\n  }\n}\n\nfunction scheduleDelayedCurrentUpdate(item: IProfileItem): void {\n  const delayMs = intervalDelayMs(item.interval)\n  if (!delayMs) return\n\n  const itemId = item.id\n  delayedUpdatePool[itemId] = setTimeout(\n    async () => {\n      delete delayedUpdatePool[itemId]\n      try {\n        await updateProfile(itemId)\n      } catch (e) {\n        await logger.warn(`[ProfileUpdater] Failed to update current profile:`, e)\n      }\n    },\n    Math.min(delayMs + 10000, MAX_TIMER_DELAY_MS)\n  )\n}\n\nexport async function initProfileUpdater(): Promise<void> {\n  const { autoUpdateProfileOnStart = true } = await getAppConfig()\n  const { items = [], current } = await getProfileConfig()\n  const currentItem = await getCurrentProfileItem()\n\n  for (const item of items.filter((i) => i.id !== current)) {\n    await auditPluginProfileVault(item)\n\n    if (item.type === 'remote' && item.autoUpdate && item.interval) {\n      await addProfileUpdater(item)\n\n      if (autoUpdateProfileOnStart) {","sourceCodeStart":89,"sourceCodeEnd":125,"githubUrl":"https://github.com/mihomo-party-org/clash-party/blob/911e090537acdf7c50bee1c3aebecc2ef119a8b5/src/main/core/profileUpdater.ts#L89-L125","documentation":"scheduleDelayedCurrentUpdate sets a setTimeout that calls updateProfile(itemId) for the currently selected profile shortly after app start, catching rejections and logging this warning. The delayed refresh of the current profile failed; the app continues with the existing on-disk profile.","triggerScenarios":"The delayed timer (delayMs+10s, capped at MAX_TIMER_DELAY_MS) fires and updateProfile(currentId) rejects — same causes as scheduled updates: network unreachable at startup, subscription endpoint error, or invalid content.","commonSituations":"App launches before network is up (Wi-Fi still connecting) so the delayed update fails; VPN/proxy not yet routed; subscription temporarily down right after app start.","solutions":["Read the captured error to distinguish network vs content failures, then retry the update from the UI.","Increase the delay or make the update retry with backoff until the network is ready.","Fix the underlying subscription URL/auth if the error is an HTTP failure."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"if (!(await isNetworkReady())) {\n  scheduleDelayedCurrentUpdate(item, 60_000) // retry later when network is up\n  return\n}","typeGuard":null,"tryCatchPattern":"try {\n  await updateProfile(itemId)\n} catch (e) {\n  logger.warn('[ProfileUpdater] Failed to update current profile:', e)\n  scheduleDelayedCurrentUpdate(item, NEXT_RETRY_DELAY_MS)\n}","preventionTips":["Gate the delayed startup update on OS network-availability events.","Make the delayed update exponential-backoff retrying instead of one-shot.","Refresh after connectivity restoration rather than a fixed timer."],"tags":["profile-update","delayed-update","startup","network"],"backgroundTag":"profile-update-failed","analyzedSha":"911e090537acdf7c50bee1c3aebecc2ef119a8b5","analyzedAt":"2026-08-30T13:00:49.174Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}