{"record":{"id":"a9de204b0781ab28","repo":"halo-dev/halo","slug":"root-resolved-to-invalid-version-resolved-ver","errorCode":null,"errorMessage":"${root} resolved to invalid version ${resolved.version} at ${resolved.packageRoot}. Install a valid published package or select IIFE output.","messagePattern":"(.+?) resolved to invalid version (.+?) at (.+?)\\. Install a valid published package or select IIFE output\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"ui/packages/ui-plugin-bundler-kit/src/runtime-snapshot.ts","lineNumber":161,"sourceCode":"  return {\n    name: packageJson.name,\n    version: packageJson.version,\n    packageRoot,\n  };\n}\n\nexport async function validateResolvedSharedPackage(\n  root: SharedPackageRoot,\n  providerRoot: string,\n  snapshot: HaloHostRuntimeSnapshot,\n  sourceId?: string\n) {\n  const resolved = await resolveSharedPackage(root, providerRoot, sourceId);\n  const hostVersion = snapshot.packages[root].version;\n  const resolvedVersion = parse(resolved.version);\n  const parsedHostVersion = parse(hostVersion);\n  if (!resolvedVersion || !parsedHostVersion) {\n    throw new Error(\n      `${root} resolved to invalid version ${resolved.version} at ${resolved.packageRoot}. ` +\n        \"Install a valid published package or select IIFE output.\"\n    );\n  }\n  return {\n    ...resolved,\n    newerThanHost: compare(resolvedVersion, parsedHostVersion) > 0,\n    differentMajor: resolvedVersion.major !== parsedHostVersion.major,\n  };\n}\n\nexport function isSharedPackageRoot(value: string): value is SharedPackageRoot {\n  return sharedPackageRootSet.has(value);\n}\n\nfunction validateSnapshotEntry(\n  root: SharedPackageRoot,\n  value: unknown","sourceCodeStart":143,"sourceCodeEnd":179,"githubUrl":"https://github.com/halo-dev/halo/blob/d2f5165f9c8f055ffcb3fa9c3f4032821a7b68c8/ui/packages/ui-plugin-bundler-kit/src/runtime-snapshot.ts#L143-L179","documentation":"Thrown by validateResolvedSharedPackage when semver.parse() returns null for either the resolved shared package's version (read from the provider's installed package.json) or the host snapshot's version. The ESM provider build needs comparable semver versions to flag major mismatches between the plugin's bundled shared dependency and the Halo host. A non-semver version string (git URL, 'file:' link, '0.0.0' placeholder, workspace protocol) makes that comparison impossible, so the build aborts rather than emitting an uncomparable artifact.","triggerScenarios":"An ESM build resolves one of SHARED_PACKAGE_ROOTS (vue, vue-router, pinia, axios, @formkit/vue, @formkit/core, @halo-dev/ui-shared, @halo-dev/components, @halo-dev/api-client, @halo-dev/richtext-editor) and the resolved package.json 'version' field is not parseable semver. Also fires if the matching host snapshot entry version is corrupt (unlikely, since snapshots are validated at load).","commonSituations":"Local dev with pnpm/yalc workspace-linked shared deps carrying version '0.0.0-use.local'; a git+ssh dependency override replacing a published package; a forked @halo-dev/components published with a non-semver tag; monorepo 'workspace:' protocol leaking into the resolved package.json.","solutions":["Run `npm ls <root>` (or pnpm why) for the offending root and replace any git/file/workspace link with a concrete published semver version, then reinstall.","If you cannot pin a real version, select IIFE output (format: 'iife' or omit explicit esm) so the bundler skips version comparison entirely.","Delete node_modules and the lockfile and reinstall to clear a stale yalc/linked package.json carrying a placeholder version.","Verify the resolved package.json version with `node -e \"console.log(require('semver').parse(require('<root>/package.json').version))\"` before building."],"exampleFix":"// before (package.json override)\n\"overrides\": { \"vue\": \"git+ssh://git@fork/vue.git\" }\n\n// after\n\"overrides\": { \"vue\": \"3.4.21\" }","handlingStrategy":"validation","validationCode":"import { parse } from \"semver\";\nimport { createRequire } from \"node:module\";\nimport { SHARED_PACKAGE_ROOTS } from \"@halo-dev/ui-plugin-bundler-kit/runtime-snapshot\";\nconst require = createRequire(import.meta.url);\nfor (const root of SHARED_PACKAGE_ROOTS) {\n  let pkg;\n  try { pkg = require(`${root}/package.json`); } catch { continue; }\n  if (!parse(pkg.version)) {\n    throw new Error(`Pre-build: ${root} resolved to non-semver version ${pkg.version}. Pin a real published version or use IIFE.`);\n  }\n}","typeGuard":"import { parse } from \"semver\";\nfunction isStableSemver(value: unknown): value is string {\n  return typeof value === \"string\" && parse(value) !== null && parse(value)!.prerelease.length === 0;\n}","tryCatchPattern":null,"preventionTips":["Never override shared dependency versions with git/file/workspace links when building ESM.","Run the pre-build version check above in CI before the Vite ESM build.","Fall back to IIFE output when shared dep versions cannot be guaranteed stable."],"tags":["build","esm","semver","bundler-kit","shared-dependency"],"backgroundTag":null,"analyzedSha":"d2f5165f9c8f055ffcb3fa9c3f4032821a7b68c8","analyzedAt":"2026-08-14T00:18:38.915Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}