pubkey/rxdb · error · RxError
DB14
DB14
Error message
RxDB Error-Code: DB14. Hint: Error messages are not included in RxDB core to reduce build size. To show the full error messages and to ensure that you do not make any mistakes when using RxDB, use the dev-mode plugin when you are in development mode: https://rxdb.info/dev-mode.html?console=error
What it means
DB14 is thrown by getReactivityFactory() when the database was created without a reactivity factory. RxDB only wires up a reactivity library (e.g. RxJS, signals, Vue, Svelte) when you pass the `reactivity` option to createRxDatabase or add the corresponding reactivity plugin. Without it, reactive state APIs have no underlying library to use.
Source
Thrown at src/rx-database.ts:212
}
}
get $(): Observable<RxChangeEvent<any>> {
return this.observable$;
}
/**
* Emits events whenever a JavaScript instance
* of RxCollection is added or removed on the RxDatabase instance.
* Does not emit anything across browser-tabs!
*/
get collections$(): Observable<RxCollectionEvent> {
return this.collectionsSubject$.asObservable();
}
public getReactivityFactory(): RxReactivityFactory<Reactivity> {
if (!this.reactivity) {
throw newRxError('DB14', { database: this.name });
}
return this.reactivity;
}
public _subs: Subscription[] = [];
/**
* Because having unhandled exceptions would fail,
* we have to store the async errors of the constructor here
* so we can throw them later.
*/
public startupErrors: (RxError | RxTypeError)[] = [];
/**
* When the database is closed,
* these functions will be called an awaited.
* Used to automatically clean up stuff that
* belongs to this collection.View on GitHub (pinned to af6fb65f94)
Solutions
- Pass a reactivity adapter when creating the database: createRxDatabase({ name, storage, reactivity: rxjs }).
- Import the adapter from its plugin package (e.g. rxdb/plugins/reactivity-rxjs or your own RxReactivityFactory implementation) and assign it.
- If you do not need reactivity, avoid calling getReactivityFactory()/reactive features instead of adding the adapter.
Example fix
// before
const db = await createRxDatabase({ name: 'mydb', storage: getRxStorageDexie() });
// after
import { rxjs } from 'rxdb/plugins/reactivity-rxjs';
const db = await createRxDatabase({ name: 'mydb', storage: getRxStorageDexie(), reactivity: rxjs }); Defensive patterns
Strategy: validation
Validate before calling
import { rxjs } from 'rxdb/plugins/reactivity-rxjs';
const db = await createRxDatabase({ name: 'mydb', storage, reactivity: rxjs }); Type guard
function hasReactivity(db: RxDatabase): boolean {
return 'reactivity' in db && db.reactivity != null;
} Try / catch
try {
const factory = db.getReactivityFactory();
} catch (err) {
if (isRxError(err) && err.code === 'DB14') {
console.error('Database created without a reactivity adapter; pass reactivity option in createRxDatabase');
} else {
throw err;
}
} Prevention
- Always pass the `reactivity` option in a shared createDatabase() helper so every code path has it.
- Match the adapter to your framework (RxJS, signals, Vue, Svelte).
- Add an early smoke test that calls getReactivityFactory() at startup.
When it happens
Trigger: Calling db.getReactivityFactory() (directly or indirectly via RxState/other reactivity-based features) on a database created without the `reactivity` option in createRxDatabase options.
Common situations: Using the RxState plugin or reactive queries after creating the database with createRxDatabase({ ... }) but forgetting `reactivity: rxjs` (or another adapter); copying a database factory that omits the option; switching databases in dev/test setups where the option was dropped.
Related errors
AI-assisted analysis of pubkey/rxdb@af6fb65f94 (2026-08-31).
Data as JSON: /api/errors/74741ef9fb4c37a9.
Report an issue: GitHub.