{"record":{"id":"6805575b18d5ba18","repo":"halo-dev/halo","slug":"root-snapshot-exports-must-be-unique-identifier","errorCode":null,"errorMessage":"${root} snapshot exports must be unique identifiers.","messagePattern":"(.+?) snapshot exports must be unique identifiers\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"ui/packages/ui-plugin-bundler-kit/src/runtime-snapshot.ts","lineNumber":197,"sourceCode":"  value: unknown\n): HostRuntimeSnapshotEntry {\n  if (\n    !isRecord(value) ||\n    typeof value.version !== \"string\" ||\n    !parseStableVersion(value.version)\n  ) {\n    throw new Error(`${root} snapshot version must be stable semver.`);\n  }\n  if (\n    !Array.isArray(value.exports) ||\n    value.exports.length === 0 ||\n    value.exports.some(\n      (exportName) =>\n        typeof exportName !== \"string\" || !/^[$A-Z_a-z][$\\w]*$/.test(exportName)\n    ) ||\n    new Set(value.exports).size !== value.exports.length\n  ) {\n    throw new Error(`${root} snapshot exports must be unique identifiers.`);\n  }\n  if (\n    !isRecord(value.runtime) ||\n    typeof value.runtime.bridge !== \"string\" ||\n    !/^[a-z0-9-]+$/.test(value.runtime.bridge) ||\n    typeof value.runtime.global !== \"string\" ||\n    !/^[$A-Z_a-z][$\\w]*$/.test(value.runtime.global) ||\n    (value.runtime.identity !== \"singleton\" &&\n      value.runtime.identity !== \"shared\")\n  ) {\n    throw new Error(`${root} snapshot runtime descriptor is invalid.`);\n  }\n  return {\n    version: value.version,\n    exports: [...value.exports].sort(),\n    runtime: {\n      bridge: value.runtime.bridge,\n      global: value.runtime.global,","sourceCodeStart":179,"sourceCodeEnd":215,"githubUrl":"https://github.com/halo-dev/halo/blob/d2f5165f9c8f055ffcb3fa9c3f4032821a7b68c8/ui/packages/ui-plugin-bundler-kit/src/runtime-snapshot.ts#L179-L215","documentation":"Thrown by validateSnapshotEntry when a snapshot entry's 'exports' array is missing, empty, contains non-strings or invalid JS identifiers, or has duplicates. The exports list defines which symbols the ESM host exposes for externalization, so each must be a unique valid ECMAScript identifier matching /^[$A-Za-z_][$\\w]*$/. Duplicates would collide on the shared global; invalid names would break import rewriting.","triggerScenarios":"Fires at module load when constructing HALO_HOST_RUNTIME_SNAPSHOTS, if a snapshot entry exports contains entries like 'default-export', '1bad', '', a number, a repeated name, or the array is absent/empty.","commonSituations":"A forked/regenerated snapshot data file lists a deep import path or a renamed symbol; a hand-edit introduces a typo or duplicate; an export named with a hyphen or leading digit.","solutions":["Audit the offending root's exports array in runtime-snapshots data: keep only unique identifiers matching /^[$A-Za-z_][$\\w]*$/.","Restore the upstream snapshot data file and re-apply only version bumps, not export edits.","Upgrade @halo-dev/ui-plugin-bundler-kit to a release with corrected snapshot exports."],"exampleFix":"// before\nexports: [\"createApp\", \"createApp\", \"h-core\"]\n\n// after\nexports: [\"createApp\", \"h\"]","handlingStrategy":"validation","validationCode":"const IDENT = /^[$A-Z_a-z][$\\w]*$/;\nfunction validateExports(root: string, exports: unknown) {\n  if (!Array.isArray(exports) || exports.length === 0 ||\n      exports.some((e) => typeof e !== \"string\" || !IDENT.test(e)) ||\n      new Set(exports).size !== exports.length) {\n    throw new Error(`${root} snapshot exports must be unique identifiers.`);\n  }\n}","typeGuard":"const IDENT = /^[$A-Z_a-z][$\\w]*$/;\nfunction isUniqueIdentifiers(value: unknown): value is string[] {\n  return Array.isArray(value) && value.length > 0 &&\n    value.every((e) => typeof e === \"string\" && IDENT.test(e)) &&\n    new Set(value).size === value.length;\n}","tryCatchPattern":null,"preventionTips":["Keep snapshot export lists in sync with the host's actual exported symbols.","Add a lint/test asserting exports match /^[A-Za-z_$][\\w$]*$/ and are unique.","Regenerate snapshots from the host build rather than editing by hand."],"tags":["build","esm","snapshot","identifier","bundler-kit"],"backgroundTag":null,"analyzedSha":"d2f5165f9c8f055ffcb3fa9c3f4032821a7b68c8","analyzedAt":"2026-08-14T00:18:38.915Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}