pubkey/rxdb · error · Error

You are using a function which must be overwritten by a plug

Error message

You are using a function which must be overwritten by a plugin.
        You should either prevent the usage of this function or add the plugin via:
            import { ${pluginName} } from 'rxdb/plugins/${pluginKey}';
            addRxPlugin(${pluginName});
        

What it means

RxQuery.update() is a stub that must be overwritten by a plugin (query-builder's update plugin / rxdb/plugins/update). Calling it without that plugin registered throws the pluginMissing error, telling you which import adds it.

Source

Thrown at src/rx-query.ts:559

            this.asRxQuery,
            (doc) => doc.incrementalRemove(),
        );
    }


    /**
     * helper function to transform RxQueryBase to RxQuery type
     */
    get asRxQuery(): RxQuery<RxDocType, RxQueryResult, OrmMethods, Reactivity> {
        return this as any;
    }

    /**
     * updates all found documents
     * @overwritten by plugin (optional)
     */
    update(_updateObj: any): Promise<RxQueryResult> {
        throw pluginMissing('update');
    }

    patch(patch: Partial<RxDocType>): Promise<RxQueryResult> {
        return runQueryUpdateFunction(
            this.asRxQuery,
            (doc) => doc.patch(patch),
        );
    }
    incrementalPatch(patch: Partial<RxDocType>): Promise<RxQueryResult> {
        return runQueryUpdateFunction(
            this.asRxQuery,
            (doc) => doc.incrementalPatch(patch),
        );
    }
    modify(mutationFunction: ModifyFunction<RxDocType>): Promise<RxQueryResult> {
        return runQueryUpdateFunction(
            this.asRxQuery,
            (doc) => doc.modify(mutationFunction),

View on GitHub (pinned to af6fb65f94)

Solutions

  1. Run `npm install rxdb/plugins/update` usage: import { updatePlugin } from 'rxdb/plugins/update'; addRxPlugin(updatePlugin); before any query.update() call.
  2. Alternatively use RxDocument-level incrementalModify/incrementalPatch per document instead of query.update().
  3. Register plugins once at app startup so all query.update() call sites work.

Example fix

// before
const result = await collection.find({ age: { $lt: 18 } }).update({ $set: { minor: true } });
// after
import { addRxPlugin } from 'rxdb';
import { updatePlugin } from 'rxdb/plugins/update';
addRxPlugin(updatePlugin);
const result = await collection.find({ age: { $lt: 18 } }).update({ $set: { minor: true } });
Defensive patterns

Strategy: try-catch

Validate before calling

import { getRxStorageDexie } from 'rxdb/plugins/dexie';
import { RXDB_VERSION } from 'rxdb';
if (!getPluginUpdateRegistered()) { addRxPlugin(updatePlugin); } // check your own registry before calling query.update()

Type guard

null

Try / catch

try {
  await query.update({ $set: { done: true } });
} catch (err) {
  if (typeof err?.message === 'string' && err.message.includes('plugin')) {
    addRxPlugin(updatePlugin);
  } else { throw err; }
}

Prevention

When it happens

Trigger: Calling myQuery.update({ $set: ... }) without importing and registering the update plugin via addRxPlugin(); production builds where dev-mode was removed along with plugin registration.

Common situations: Copying examples from the docs (which assume plugins) into a slim build; tree-shaken bundles that dropped the addRxPlugin call; upgrading RxDB where query update moved behind an optional plugin.

Related errors


AI-assisted analysis of pubkey/rxdb@af6fb65f94 (2026-08-31). Data as JSON: /api/errors/1491c1f45e7663fb. Report an issue: GitHub.