{"record":{"id":"19e8aa84d43b5104","repo":"emberjs/ember.js","slug":"the-glimmer-validator-library-has-been-included","errorCode":null,"errorMessage":"The `@glimmer/validator` library has been included twice in this application. It could be different versions of the package, or the same version included twice by mistake. `@glimmer/validator` depends on having a single copy of the package in use at any time in an application, even if they are the same version. You must dedupe your build to remove the duplicate packages in order to prevent this error.","messagePattern":"The `@glimmer/validator` library has been included twice in this application\\. It could be different versions of the package, or the same version included twice by mistake\\. `@glimmer/validator` depends on having a single copy of the package in use at any time in an application, even if they are the same version\\. You must dedupe your build to remove the duplicate packages in order to prevent this error\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"packages/@glimmer/validator/index.ts","lineNumber":4,"sourceCode":"const GLIMMER_VALIDATOR_REGISTRATION = Symbol('GLIMMER_VALIDATOR_REGISTRATION');\n\nif (Reflect.has(globalThis, GLIMMER_VALIDATOR_REGISTRATION)) {\n  throw new Error(\n    'The `@glimmer/validator` library has been included twice in this application. It could be different versions of the package, or the same version included twice by mistake. `@glimmer/validator` depends on having a single copy of the package in use at any time in an application, even if they are the same version. You must dedupe your build to remove the duplicate packages in order to prevent this error.'\n  );\n}\n\nReflect.set(globalThis, GLIMMER_VALIDATOR_REGISTRATION, true);\n\nexport { trackedArray } from './lib/collections/array';\nexport { trackedMap } from './lib/collections/map';\nexport { trackedObject } from './lib/collections/object';\nexport { trackedSet } from './lib/collections/set';\nexport { trackedWeakMap } from './lib/collections/weak-map';\nexport { trackedWeakSet } from './lib/collections/weak-set';\nexport { debug } from './lib/debug';\nexport { dirtyTagFor, tagFor, type TagMeta, tagMetaFor } from './lib/meta';\nexport { trackedData } from './lib/tracked-data';\nexport {\n  type Reactive,\n  type ReadOnlyReactive,","sourceCodeStart":1,"sourceCodeEnd":22,"githubUrl":"https://github.com/emberjs/ember.js/blob/26f97246a8bf2e28edf26ac3093da2e86c04ffc5/packages/@glimmer/validator/index.ts#L1-L22","documentation":"@glimmer/validator keeps module-global mutable state (the tracking transaction stack), so two copies of the package in one app would maintain separate, inconsistent tracking state. At import time the module registers a symbol on globalThis and throws if the symbol already exists — meaning the package was bundled twice (any versions, even identical).","triggerScenarios":"Loading any API from @glimmer/validator (e.g. `track`, `createTag`, `consumeTag`) after it has already been imported once from a different bundle/copy — the module-level guard at index.ts fires on the second evaluation.","commonSituations":"Duplicate dependency versions in node_modules (e.g. one via ember-source, one directly); mixing a bundled copy (Ember CLI `vendor`) with an npm-imported copy; monorepo/workspace hoisting failures; mixing embroider and classic builds.","solutions":["Run `npm ls @glimmer/validator` (or yarn/pnpm equivalent) to find duplicate copies.","Dedupe: `npm dedupe` / yarn resolutions / pnpm overrides to force a single version.","Ensure ember-source and any direct @glimmer/* deps resolve to the same copy (align versions, add a resolution entry).","Check bundler config for accidental double bundling (e.g. both vendor.js and an import of the package).","Clear caches and rebuild (node_modules reinstall) after fixing the dependency tree."],"exampleFix":"// before (package.json)\n{\n  \"dependencies\": { \"@glimmer/validator\": \"^0.42.0\" }\n}\n\n// after (package.json)\n{\n  \"overrides\": {\n    \"@glimmer/validator\": \"$ember-source-installed-version\"\n  }\n}\n// then: rm -rf node_modules && npm install","handlingStrategy":"validation","validationCode":"#!/usr/bin/env node\nconst { execSync } = require('child_process');\nconst out = execSync('npm ls @glimmer/validator --all', { encoding: 'utf8' });\nconst lines = out.split('\\n').filter((l) => l.includes('@glimmer/validator'));\nif (lines.length > 1) {\n  console.error('Duplicate @glimmer/validator detected:\\n' + out);\n  process.exit(1);\n}","typeGuard":null,"tryCatchPattern":"try {\n  require('@glimmer/validator');\n} catch (e) {\n  if (e.message.includes('has been included twice')) {\n    console.error('Dedupe your build: npm ls @glimmer/validator, add resolutions/overrides, reinstall.');\n  }\n  throw e;\n}","preventionTips":["Run `npm ls @glimmer/validator` in CI to detect duplicates before build.","Add a package.json override/resolution pinning a single version.","Don't import @glimmer/* packages directly when ember-source already provides them; align versions if you must.","Reinstall node_modules from a clean state after dependency changes."],"tags":["glimmer","validator","duplicate-package","build","dependency-management"],"backgroundTag":"duplicate-library-included-twice","analyzedSha":"26f97246a8bf2e28edf26ac3093da2e86c04ffc5","analyzedAt":"2026-09-01T05:01:28.182Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}