emberjs/ember.js · error · Error
Assertion Failed: ${desc}
Error message
Assertion Failed: ${desc} What it means
Ember's assert() (from @ember/debug) throws an Error with the message 'Assertion Failed: <desc>' when its second argument is falsy. It is Ember's internal way to surface invariant violations in framework code and in apps during development.
Source
Thrown at packages/@ember/debug/lib/assert.ts:54
// Fail unconditionally
assert('This code path should never be run');
```
@method assert
@static
@for @ember/debug
@param {String} description Describes the expectation. This will become the
text of the Error thrown if the assertion fails.
@param {any} condition Must be truthy for the assertion to pass. If
falsy, an exception will be thrown.
@public
@since 1.0.0
*/
function assert(desc: string): never;
function assert(desc: string, test: unknown): asserts test;
function assert(desc: string, test?: unknown): asserts test {
if (!test) {
throw new Error(`Assertion Failed: ${desc}`);
}
}
setAssert(assert);
}
View on GitHub (pinned to 26f97246a8)
Solutions
- Read the desc after 'Assertion Failed:' to identify the violated invariant
- Fix the condition the assertion checks (supply the missing value / correct the call)
- Search Ember source or the failing addon for the assert to understand the contract
Example fix
// before
this.set('controller', getOwner(this).lookup('controller:missing'));
// after
let controller = getOwner(this).lookup('controller:missing');
assert('Expected controller:missing to be registered', controller);
this.set('controller', controller); Defensive patterns
Strategy: try-catch
Validate before calling
// validate the invariant before the call that asserts it
assert('model must be loaded', model != null); Type guard
function hasModel(obj) { return obj != null && typeof obj === 'object'; } Try / catch
try { riskyOperation(); } catch (e) { if (!/^Assertion Failed:/.test(e.message)) throw e; handleInvariantViolation(e.message.replace('Assertion Failed: ', '')); } Prevention
- Keep asserts enabled in test envs and fix the root cause, not the assert
- Read the desc text to locate the violated contract
- Supply required values before calling framework APIs
- Pin framework versions and read deprecation guides when upgrading
When it happens
Trigger: Any internal or app-level call to assert(desc, condition) where condition is falsy — e.g. assert('must have a model', this.model).
Common situations: Framework invariant violations during upgrade (removed/renamed APIs), passing undefined where a required value is expected, misconfigured initializers.
Related errors
- deprecation override for ${id} not found
- BUG: owner is missing renderer
- You must pass both the owner and args to super() in your com
- You must pass both the owner and args to super() in your com
- Cannot call `.lookup('${fullName}')` after the owner has bee
AI-assisted analysis of emberjs/ember.js@26f97246a8 (2026-09-01).
Data as JSON: /api/errors/3e6b32699b000d5c.
Report an issue: GitHub.