{"record":{"id":"782f52ec21844a6d","repo":"different-ai/openwork","slug":"installed-version-could-not-be-validated-for-a-tar","errorCode":null,"errorMessage":"Installed version could not be validated for a targeted update.","messagePattern":"Installed version could not be validated for a targeted update\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"apps/desktop/electron/updater.mjs","lineNumber":172,"sourceCode":"    if (leftPart !== rightPart) return leftPart < rightPart ? -1 : 1;\n  }\n\n  return comparePrereleaseIdentifiers(parsedLeft.prerelease, parsedRight.prerelease);\n}\n\nfunction isVersionNewer(candidate, current) {\n  const comparison = compareVersions(candidate, current);\n  return comparison === null ? candidate !== current : comparison > 0;\n}\n\nexport function targetedStableUpdaterFeed(currentVersion, targetVersion, allowOlder = false) {\n  const normalizedTarget = normalizeStableTargetVersion(targetVersion);\n  if (!normalizedTarget) {\n    throw new Error(\"Target update version must use the stable x.y.z format.\");\n  }\n  const comparison = compareVersions(normalizedTarget, currentVersion);\n  if (comparison === null) {\n    throw new Error(\"Installed version could not be validated for a targeted update.\");\n  }\n  if (comparison === 0 || (!allowOlder && comparison < 0)) {\n    throw new Error(allowOlder\n      ? \"Recovery target version must differ from the installed version.\"\n      : \"Target update version must be newer than the installed version.\");\n  }\n  return `https://github.com/different-ai/openwork/releases/download/v${normalizedTarget}`;\n}\n\nfunction updaterChannelState(app, channel, targetVersion = null, manifestChannel = \"latest\") {\n  const normalized = normalizeElectronUpdaterChannel(channel, manifestChannel);\n  const currentVersion = resolveAppVersion(app);\n  return {\n    channel: normalized,\n    feedUrl: targetVersion\n      ? targetedStableUpdaterFeed(currentVersion, targetVersion)\n      : electronUpdaterFeedUrl(normalized, manifestChannel),\n    currentVersion,","sourceCodeStart":154,"sourceCodeEnd":190,"githubUrl":"https://github.com/different-ai/openwork/blob/2b7df46e8ae1517d64c896c7793d2d52ec845669/apps/desktop/electron/updater.mjs#L154-L190","documentation":"Thrown by `targetedStableUpdaterFeed` when `compareVersions(normalizedTarget, currentVersion)` returns null, meaning the currently installed version could not be parsed/compared at all. The updater must know the relationship between installed and target versions to build a safe feed, so an unparseable current version aborts the targeted update.","triggerScenarios":"Calling targetedStableUpdaterFeed with a currentVersion that compareVersions cannot handle — e.g. a dev build string, empty/null currentVersion, or a non-semver version from app.getVersion() in an unpackaged/dev environment.","commonSituations":"Running a dev or locally-built app whose version string is not stable x.y.z; corrupted app metadata; test harness passing placeholder version values.","solutions":["Pass a valid x.y.z currentVersion (same normalization rules as the target)","In dev, guard targeted-update code paths or supply a synthetic valid version","Check where currentVersion originates (app.getVersion()) and why it is malformed"],"exampleFix":"// before\ntargetedStableUpdaterFeed(app.getVersion(), target); // dev version like '0.0.0-dev'\n// after\nconst current = /^\\d+\\.\\d+\\.\\d+$/.test(app.getVersion())\n  ? app.getVersion()\n  : '0.0.0';\ntargetedStableUpdaterFeed(current, target);","handlingStrategy":"validation","validationCode":"function currentVersionComparable(v) {\n  return typeof v === 'string' && /^\\d+\\.\\d+\\.\\d+$/.test(v);\n}","typeGuard":null,"tryCatchPattern":"try {\n  const feed = targetedStableUpdaterFeed(current, target);\n} catch (e) {\n  if (e.message.startsWith('Installed version could not be validated')) {\n    showError('Cannot targeted-update from a dev/unparsed version');\n  } else throw e;\n}","preventionTips":["Check the installed version parses as x.y.z before enabling targeted updates","Skip/disable targeted update flows for dev builds","Log app.getVersion() when the check fails to spot malformed sources","Validate both current and target versions with the same regex"],"tags":["versioning","updater","validation"],"backgroundTag":"invalid-version-format","analyzedSha":"2b7df46e8ae1517d64c896c7793d2d52ec845669","analyzedAt":"2026-09-01T07:59:23.713Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}