{"record":{"id":"1df09085b2b24d42","repo":"different-ai/openwork","slug":"could-not-determine-the-installed-openwork-version","errorCode":null,"errorMessage":"Could not determine the installed OpenWork version.","messagePattern":"Could not determine the installed OpenWork version\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"apps/app/src/react-app/domains/settings/state/electron-updater-state.ts","lineNumber":393,"sourceCode":"    try {\n      let targetVersion: string | undefined;\n      const releaseChannelResolution = await resolvePolicyReleaseChannel(\n        requestedReleaseChannel,\n      );\n      if (!isCurrentRequest()) return;\n      const activeReleaseChannel = releaseChannelResolution.channel;\n      const freshDesktopConfig = releaseChannelResolution.desktopConfig;\n      if (activeReleaseChannel !== requestedReleaseChannel) {\n        onReleaseChannelChange(activeReleaseChannel);\n        await bridge.setChannel?.(activeReleaseChannel);\n        if (!isCurrentRequest()) return;\n      }\n      if (manual && activeReleaseChannel === \"stable\") {\n        const channelState = await bridge.getChannel?.();\n        if (!isCurrentRequest()) return;\n        const currentVersion = channelState?.currentVersion ?? appVersion;\n        if (!currentVersion) {\n          throw new Error(\"Could not determine the installed OpenWork version.\");\n        }\n\n        const selection = await resolveFreshStableDesktopUpdate({\n          currentVersion,\n          refreshDesktopConfig,\n        });\n        if (!isCurrentRequest()) return;\n        if (!selection) {\n          throw new Error(\"Den returned an invalid desktop release inventory.\");\n        }\n        if (selection.kind === \"blocked\") {\n          setUpdateStatus({\n            state: \"blocked\",\n            lastCheckedAt: Date.now(),\n            version: selection.latestPublishedVersion,\n            message: t(\"settings.update_blocked_org\", undefined, {\n              version: selection.latestPublishedVersion,\n            }),","sourceCodeStart":375,"sourceCodeEnd":411,"githubUrl":"https://github.com/different-ai/openwork/blob/2b7df46e8ae1517d64c896c7793d2d52ec845669/apps/app/src/react-app/domains/settings/state/electron-updater-state.ts#L375-L411","documentation":"During a manual update check on the stable channel, useElectronUpdaterState resolves the currently installed version from the update bridge channel state, falling back to the app version. If both are missing/empty it cannot proceed to resolveFreshStableDesktopUpdate and throws. The updater needs a concrete installed version to compare against published releases.","triggerScenarios":"Manual 'check for updates' on the stable channel when bridge.getChannel() returns null/undefined or an object with no currentVersion, AND the appVersion fallback is also empty or undefined.","commonSituations":"Bridge API not yet initialized or the getChannel capability is missing (older desktop bridge), corrupted or missing app metadata in dev builds, running a packaged build where version info was not embedded.","solutions":["Ensure the app build embeds a valid version (check appVersion passed into the hook).","Verify the desktop bridge exposes getChannel and returns currentVersion; update the desktop runtime if the capability is missing.","Retry the update check after the bridge finishes initializing.","If in a dev build, expect this may be unavoidable and gate the manual check on a known version."],"exampleFix":"// before\nconst currentVersion = channelState?.currentVersion ?? appVersion;\nif (!currentVersion) {\n  throw new Error(\"Could not determine the installed OpenWork version.\");\n}\n// after\nconst currentVersion = channelState?.currentVersion ?? appVersion ?? DEFAULT_APP_VERSION;\nif (!currentVersion) {\n  setUpdateStatus({ state: \"unavailable\", lastCheckedAt: Date.now() }); // degrade gracefully\n  return;\n}","handlingStrategy":"fallback","validationCode":"const channelState = await bridge.getChannel?.();\nconst version = channelState?.currentVersion ?? appVersion;\nif (!version) { /* skip update check and show 'version unknown' state */ }","typeGuard":"function hasVersion(s: { currentVersion?: string } | null | undefined): s is { currentVersion: string } {\n  return typeof s?.currentVersion === \"string\" && s.currentVersion.length > 0;\n}","tryCatchPattern":"try {\n  await checkForUpdates({ manual: true });\n} catch (err) {\n  if (err.message.includes(\"Could not determine the installed\")) setUpdateStatus({ state: \"unavailable\" });\n  else throw err;\n}","preventionTips":["Ensure builds always embed a non-empty app version","Keep the desktop bridge's getChannel capability implemented and current","Gate update checks on bridge readiness"],"tags":["updater","version-detection","electron","bridge"],"backgroundTag":"missing-version-metadata","analyzedSha":"2b7df46e8ae1517d64c896c7793d2d52ec845669","analyzedAt":"2026-09-01T07:59:23.713Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}