{"record":{"id":"efa580cd508b7f72","repo":"pubkey/rxdb","slug":"you-are-using-a-function-which-must-be-overwritten","errorCode":null,"errorMessage":"You are using a function which must be overwritten by a plugin.\n        You should either prevent the usage of this function or add the plugin via:\n            import { ${pluginName} } from 'rxdb/plugins/${pluginKey}';\n            addRxPlugin(${pluginName});\n        ","messagePattern":"You are using a function which must be overwritten by a plugin\\.\n        You should either prevent the usage of this function or add the plugin via:\n            import (.+?) from 'rxdb/plugins/(.+?)';\n            addRxPlugin\\((.+?)\\);\n        ","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/rx-database.ts","lineNumber":543,"sourceCode":"        return this.idleQueue.requestIdlePromise();\n    }\n\n    /**\n     * Export database to a JSON friendly format.\n     */\n    exportJSON(\n        _collectionsOrOptions?: string[] | RxDumpOptions,\n        _options?: RxDumpOptions\n    ): Promise<RxDumpDatabase<Collections>>;\n    exportJSON(\n        _collectionsOrOptions?: string[] | RxDumpOptions,\n        _options?: RxDumpOptions\n    ): Promise<RxDumpDatabaseAny<Collections>>;\n    exportJSON(\n        _collectionsOrOptions?: string[] | RxDumpOptions,\n        _options?: RxDumpOptions\n    ): Promise<any> {\n        throw pluginMissing('json-dump');\n    }\n\n    addState<T = any>(_name?: string): Promise<RxState<T, Reactivity>> {\n        throw pluginMissing('state');\n    }\n\n    /**\n     * Import the parsed JSON export into the collection.\n     * @param _exportedJSON The previously exported data from the `<db>.exportJSON()` method.\n     * @note When an interface is loaded in this collection all base properties of the type are typed as `any`\n     * since data could be encrypted.\n     */\n    importJSON(_exportedJSON: RxDumpDatabaseAny<Collections>): Promise<void> {\n        throw pluginMissing('json-dump');\n    }\n\n    backup(_options: BackupOptions): RxBackupState {\n        throw pluginMissing('backup');","sourceCodeStart":525,"sourceCodeEnd":561,"githubUrl":"https://github.com/pubkey/rxdb/blob/af6fb65f94cd70558d74c23799eda11ff1c15224/src/rx-database.ts#L525-L561","documentation":"exportJSON() is a stub in RxDB core that throws pluginMissing('json-dump'). Full-database JSON dump/import lives in the json-dump plugin, which must be added via addRxPlugin so the real implementation overwrites this stub. Calling the stub means the plugin was not added.","triggerScenarios":"Calling db.exportJSON() (or the overload with collection names / RxDumpOptions) on a database created without the json-dump plugin registered.","commonSituations":"Forgetting `import { getRxStorageJSONDump } / wrappedValidate...` style plugin registration, specifically `addRxPlugin(RxDBJsonDumpPlugin)` from 'rxdb/plugins/json-dump'; following old docs that imported it implicitly; tree-shaking dropped the side-effect import.","solutions":["Import and add the plugin: import { RxDBJsonDumpPlugin } from 'rxdb/plugins/json-dump'; addRxPlugin(RxDBJsonDumpPlugin); before calling exportJSON.","Add the plugin once at application startup, before any dump code runs.","If you only need per-collection export, note collection.exportJSON also requires the same json-dump plugin."],"exampleFix":"// before\nconst dump = await db.exportJSON();\n// after\nimport { RxDBJsonDumpPlugin } from 'rxdb/plugins/json-dump';\nimport { addRxPlugin } from 'rxdb';\naddRxPlugin(RxDBJsonDumpPlugin);\nconst dump = await db.exportJSON();","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  return await db.exportJSON();\n} catch (err) {\n  if (typeof err.message === 'string' && err.message.includes('json-dump')) {\n    throw new Error('Add the json-dump plugin: addRxPlugin(RxDBJsonDumpPlugin)');\n  }\n  throw err;\n}","preventionTips":["Register all optional plugins (json-dump, state, backup, leader-election) in a single central bootstrap module.","Run a startup self-test in dev mode that touches plugin-backed methods.","Never rely on side-effect imports for plugin registration; call addRxPlugin explicitly."],"tags":["missing-plugin","json-dump","export"],"backgroundTag":"plugin-not-installed","analyzedSha":"af6fb65f94cd70558d74c23799eda11ff1c15224","analyzedAt":"2026-08-31T23:32:37.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}