mobxjs/mobx · warning

WARNING: Debug feature only. MobX will NOT recover from erro

Error message

WARNING: Debug feature only. MobX will NOT recover from errors when `disableErrorBoundaries` is enabled.

What it means

configure({ disableErrorBoundaries: true }) tells MobX to stop catching errors inside reactions/derivations so stack traces surface directly in the debugger. Because MobX's internal state can then be left corrupted after a thrown error, it is debug-only, and MobX prints this console warning when it is enabled in development builds.

Source

Thrown at packages/mobx/src/api/configure.ts:44

    if (enforceActions !== undefined) {
        const ea = enforceActions === ALWAYS ? ALWAYS : enforceActions === OBSERVED
        globalState.enforceActions = ea
        globalState.allowStateChanges = ea === true || ea === ALWAYS ? false : true
    }
    ;[
        "computedRequiresReaction",
        "reactionRequiresObservable",
        "observableRequiresReaction",
        "disableErrorBoundaries",
        "safeDescriptors"
    ].forEach(key => {
        if (key in options) {
            globalState[key] = !!options[key]
        }
    })
    globalState.allowStateReads = !globalState.observableRequiresReaction
    if (__DEV__ && globalState.disableErrorBoundaries === true) {
        console.warn(
            "WARNING: Debug feature only. MobX will NOT recover from errors when `disableErrorBoundaries` is enabled."
        )
    }
    if (options.reactionScheduler) {
        setReactionScheduler(options.reactionScheduler)
    }
}

View on GitHub (pinned to 01211a698b)

Solutions

  1. Remove `disableErrorBoundaries: true` from production/test configuration once debugging is done
  2. Enable it only temporarily in local dev sessions
  3. If it must stay in dev, gate it: only pass the option when process.env.DEBUG_MOBX is set

Example fix

// before
configure({ disableErrorBoundaries: true })
// after
if (process.env.DEBUG_MOBX) configure({ disableErrorBoundaries: true })
Defensive patterns

Strategy: validation

Validate before calling

// guard before enabling
if (process.env.NODE_ENV === 'production') {
    throw new Error('disableErrorBoundaries is debug-only and must not be enabled in production')
}
configure({ disableErrorBoundaries: true })

Type guard

function isSafeConfigureOptions(o: Record<string, unknown>): boolean {
    return !o.disableErrorBoundaries || process.env.NODE_ENV !== 'production'
}

Try / catch

null

Prevention

When it happens

Trigger: Calling `configure({ disableErrorBoundaries: true })` in a __DEV__ build; it is a console.warn (not a throw) emitted by configure().

Common situations: Debugging where an exception originates inside a computed or reaction; copied debug config left in committed code; test setup utilities enabling it for easier assertion of thrown errors.

Related errors


AI-assisted analysis of mobxjs/mobx@01211a698b (2026-08-28). Data as JSON: /api/errors/82d83def00c3368f. Report an issue: GitHub.