emberjs/ember.js · critical · Error
The `@glimmer/validator` library has been included twice in
Error message
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.
What it means
@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).
Source
Thrown at packages/@glimmer/validator/index.ts:4
const GLIMMER_VALIDATOR_REGISTRATION = Symbol('GLIMMER_VALIDATOR_REGISTRATION');
if (Reflect.has(globalThis, GLIMMER_VALIDATOR_REGISTRATION)) {
throw new Error(
'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.'
);
}
Reflect.set(globalThis, GLIMMER_VALIDATOR_REGISTRATION, true);
export { trackedArray } from './lib/collections/array';
export { trackedMap } from './lib/collections/map';
export { trackedObject } from './lib/collections/object';
export { trackedSet } from './lib/collections/set';
export { trackedWeakMap } from './lib/collections/weak-map';
export { trackedWeakSet } from './lib/collections/weak-set';
export { debug } from './lib/debug';
export { dirtyTagFor, tagFor, type TagMeta, tagMetaFor } from './lib/meta';
export { trackedData } from './lib/tracked-data';
export {
type Reactive,
type ReadOnlyReactive,View on GitHub (pinned to 26f97246a8)
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.
Example fix
// before (package.json)
{
"dependencies": { "@glimmer/validator": "^0.42.0" }
}
// after (package.json)
{
"overrides": {
"@glimmer/validator": "$ember-source-installed-version"
}
}
// then: rm -rf node_modules && npm install Defensive patterns
Strategy: validation
Validate before calling
#!/usr/bin/env node
const { execSync } = require('child_process');
const out = execSync('npm ls @glimmer/validator --all', { encoding: 'utf8' });
const lines = out.split('\n').filter((l) => l.includes('@glimmer/validator'));
if (lines.length > 1) {
console.error('Duplicate @glimmer/validator detected:\n' + out);
process.exit(1);
} Try / catch
try {
require('@glimmer/validator');
} catch (e) {
if (e.message.includes('has been included twice')) {
console.error('Dedupe your build: npm ls @glimmer/validator, add resolutions/overrides, reinstall.');
}
throw e;
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Cannot update a frozen TrackedValue${this.#options.descripti
- attempted to close a tracking frame, but one was not open
- Compile Error: ${template.problem} @ ${template.span.start}.
- A resolved helper cannot be passed as a named argument as th
- deprecation override for ${id} not found
AI-assisted analysis of emberjs/ember.js@26f97246a8 (2026-09-01).
Data as JSON: /api/errors/19e8aa84d43b5104.
Report an issue: GitHub.