{"record":{"id":"53809d46dffde22f","repo":"upstash/context7","slug":"couldn-t-check-for-updates-right-now","errorCode":null,"errorMessage":"Couldn't check for updates right now.","messagePattern":"Couldn't check for updates right now\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/cli/src/commands/upgrade.ts","lineNumber":130,"sourceCode":"  }\n\n  log.box([\n    `${pc.white(pc.bold(\"Update available:\"))} ${pc.green(pc.bold(`v${info.currentVersion}`))} ${pc.dim(\"->\")} ${pc.green(pc.bold(`v${info.latestVersion}`))}`,\n    `${pc.white(\"Run\")} ${pc.yellow(pc.bold(\"ctx7 upgrade\"))} ${pc.white(\"to update now\")}`,\n    `${pc.white(\"Or run\")} ${pc.yellow(info.upgradePlan.displayCommand)}`,\n  ]);\n  await markUpdateNotificationShown(info.latestVersion);\n  log.blank();\n}\n\nasync function upgradeCommand(options: UpgradeOptions): Promise<void> {\n  trackEvent(\"command\", { name: \"upgrade\" });\n\n  const info = await checkForUpdates({ force: true });\n  const plan = info?.upgradePlan ?? getUpgradePlan();\n\n  if (!info) {\n    log.warn(\"Couldn't check for updates right now.\");\n    log.info(`Try again later or run ${pc.cyan(plan.displayCommand)} manually.`);\n    return;\n  }\n\n  if (!info.updateAvailable) {\n    log.success(`ctx7 is up to date (${pc.bold(`v${VERSION}`)})`);\n    return;\n  }\n\n  log.blank();\n  log.info(\n    `Update available: ${pc.bold(`v${info.currentVersion}`)} ${pc.dim(\"->\")} ${pc.bold(`v${info.latestVersion}`)}`\n  );\n\n  if (plan.needsExplicitVersion) {\n    log.info(`You're using an ephemeral runner (${plan.installMethod}).`);\n    log.info(`Use ${pc.cyan(plan.displayCommand)} to run the latest version immediately.`);\n    log.info(`Or install globally with ${pc.cyan(\"npm install -g ctx7@latest\")}.`);","sourceCodeStart":112,"sourceCodeEnd":148,"githubUrl":"https://github.com/upstash/context7/blob/4416fb855b8f752be735e34f943b5d0762701aad/packages/cli/src/commands/upgrade.ts#L112-L148","documentation":"`ctx7 upgrade` calls checkForUpdates({ force: true }) to query the update service. If the call returns null (network failure, timeout, or resolver error), the command warns that it couldn't check for updates, prints the manual upgrade command (plan.displayCommand), and exits without modifying the installation. The local getUpgradePlan() is still used to tell the user how to upgrade manually.","triggerScenarios":"Running `ctx7 upgrade` when checkForUpdates returns null/undefined — update-server request failed (offline, DNS failure, proxy blocking, request timeout, or the update endpoint returning an error).","commonSituations":"No internet connection or corporate proxy/firewall blocking the update endpoint; transient update-server outage; DNS misconfiguration; VPN disconnect mid-check.","solutions":["Follow the printed manual command (e.g. `npm install -g @upstash/context7-mcp@latest` / reinstall via your package manager)","Check network connectivity / proxy settings and retry `ctx7 upgrade`","Retry later — may be a transient update-server issue","Verify no firewall blocks the update endpoint; if behind a proxy, set HTTP(S)_PROXY env vars"],"exampleFix":"// before\n$ ctx7 upgrade   # fails offline\n// after\n$ ctx7 upgrade   # after restoring network\n# or manually:\n$ npm install -g <ctx7-package>@latest","handlingStrategy":"retry","validationCode":"// Probe connectivity before upgrading\nconst online = await fetch('https://api.github.com', { method: 'HEAD' })\n  .then(() => true).catch(() => false);\nif (!online) console.log('Offline — upgrade manually: npm install -g <ctx7-package>@latest');","typeGuard":"const info = await checkForUpdates({ force: true });\nif (info == null || typeof info !== 'object') return; // fall back to manual upgrade command\nconst hasUpdate: boolean = Boolean((info as any).updateAvailable);","tryCatchPattern":"try {\n  const info = await checkForUpdates({ force: true });\n  if (!info) {\n    log.warn(\"Couldn't check for updates right now.\");\n    log.info(`Try again later or run ${plan.displayCommand} manually.`);\n    return;\n  }\n} catch (err) {\n  log.warn(`Update check failed: ${err}. Install manually instead.`);\n}","preventionTips":["Keep network/proxy config valid (HTTPS_PROXY) so the update endpoint is reachable","Remember the printed manual upgrade command as a fallback for offline machines","Retry once on transient failures before giving up","Pin package versions in CI so upgrade checks are not on the critical path"],"tags":["cli","network","update-check","offline"],"backgroundTag":"network-request-failed","analyzedSha":"4416fb855b8f752be735e34f943b5d0762701aad","analyzedAt":"2026-09-16T20:28:07.148Z","contentChangedAt":"2026-09-16T20:28:07.148Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}