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

RxDocument.update() is a stub that is overwritten by an optional plugin. RxDB core ships only the placeholder; calling it without the matching plugin throws pluginMissing. The message tells you which plugin to import and register via addRxPlugin.

Source

Thrown at src/rx-document.ts:284

            delete (data as any)._attachments;
            delete (data as any)._deleted;
            delete (data as any)._meta;
            return overwritable.deepFreezeWhenDevMode(data);
        } else {
            return overwritable.deepFreezeWhenDevMode(this._data);
        }
    },
    toMutableJSON(this: RxDocument, withMetaFields = false) {
        return clone(this.toJSON(withMetaFields as any));
    },

    /**
     * updates document
     * @overwritten by plugin (optional)
     * @param updateObj mongodb-like syntax
     */
    update(_updateObj: UpdateQuery<any>) {
        throw pluginMissing('update');
    },
    incrementalUpdate(_updateObj: UpdateQuery<any>) {
        throw pluginMissing('update');
    },
    updateCRDT(_updateObj: CRDTEntry<any> | CRDTEntry<any>[]) {
        throw pluginMissing('crdt');
    },
    putAttachment() {
        throw pluginMissing('attachments');
    },
    putAttachmentBase64() {
        throw pluginMissing('attachments');
    },
    getAttachment() {
        throw pluginMissing('attachments');
    },
    allAttachments() {
        throw pluginMissing('attachments');

View on GitHub (pinned to af6fb65f94)

Solutions

  1. import { RxDBUpdatePlugin } from 'rxdb/plugins/update'; addRxPlugin(RxDBUpdatePlugin);
  2. Alternatively use incrementalUpdate from 'rxdb/plugins/incremental-write' or a full-document put/patch
  3. Check AGENTS/docs: the modern import path is rxdb/plugins/update

Example fix

// before
doc.update({ $set: { age: 5 } }); // pluginMissing
// after
import { RxDBUpdatePlugin } from 'rxdb/plugins/update';
addRxPlugin(RxDBUpdatePlugin);
doc.update({ $set: { age: 5 } });
Defensive patterns

Strategy: fallback

Validate before calling

import { RxDBUpdatePlugin } from 'rxdb/plugins/update';
// ensure once at startup:
if (!overwritableMethodsUpdated()) { addRxPlugin(RxDBUpdatePlugin); }

Try / catch

try {
  await doc.update({ $set: { age: 5 } });
} catch (err) {
  if (String(err.message).includes('must be overwritten by a plugin')) {
    return doc.incrementalPatch({ age: 5 }); // core fallback
  }
  throw err;
}

Prevention

When it happens

Trigger: Calling doc.update({ $set: { age: 5 } }) without importing 'rxdb/plugins/update'; using mongodb-like update operators without the update plugin; a setup where the plugin was removed during tree-shaking or refactor.

Common situations: Following docs examples that assume the update plugin is installed; forgetting to call addRxPlugin() after import; production build differing from dev because the plugin import was dropped.

Related errors


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