{"record":{"id":"e4840251f4774c02","repo":"pubkey/rxdb","slug":"db12","errorCode":"DB12","errorMessage":"RxDB Error-Code: DB12. 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","messagePattern":"RxDB Error-Code: DB12\\. 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","errorType":"error_code","errorClass":"RxError","httpStatus":null,"severity":"error","filePath":"src/rx-database.ts","lineNumber":454,"sourceCode":"\n        /**\n         * If the ensureNoStartupErrors or the bulkWrite error handling throws,\n         * we must close any pre-created storage instances to avoid resource leaks.\n         */\n        let putDocsResult;\n        try {\n            [putDocsResult] = await Promise.all([\n                this.internalStore.bulkWrite(\n                    bulkPutDocs,\n                    'rx-database-add-collection'\n                ),\n                ensureNoStartupErrors(this)\n            ]);\n\n            await Promise.all(\n                putDocsResult.error.map(async (error) => {\n                    if (error.status !== 409) {\n                        throw newRxError('DB12', {\n                            database: this.name,\n                            writeError: error\n                        });\n                    }\n                    const docInDb: RxDocumentData<InternalStoreCollectionDocType> = ensureNotFalsy(error.documentInDb);\n                    const collectionName = docInDb.data.name;\n                    const schema = (schemas as any)[collectionName];\n                    // collection already exists but has different schema\n                    if (docInDb.data.schemaHash !== await schema.hash) {\n                        throw newRxError('DB6', {\n                            database: this.name,\n                            collection: collectionName,\n                            previousSchemaHash: docInDb.data.schemaHash,\n                            schemaHash: await schema.hash,\n                            previousSchema: docInDb.data.schema,\n                            schema: ensureNotFalsy((jsonSchemas as any)[collectionName])\n                        });\n                    }","sourceCodeStart":436,"sourceCodeEnd":472,"githubUrl":"https://github.com/pubkey/rxdb/blob/af6fb65f94cd70558d74c23799eda11ff1c15224/src/rx-database.ts#L436-L472","documentation":"DB12 is thrown when writing the internal collection metadata documents during addCollections() and the storage returns a write error with a status other than 409 (conflict). A 409 is handled (schema-compare logic), but any other status means the internal store failed unexpectedly, so RxDB surfaces the raw write error wrapped in DB12.","triggerScenarios":"bulkWrite of the internal collection docs in addCollections() fails with a non-409 error, e.g. storage-level failures (quota exceeded, storage closed, invalid document, IO error) while creating collections.","commonSituations":"IndexedDB quota exceeded in the browser; using a storage instance that was already closed; storage adapter bugs or mismatched internal store schema after a RxDB major upgrade with an old on-disk internal store.","solutions":["Inspect error.writeError.status in the dev-mode plugin output to identify the underlying storage failure.","Free up storage/quota (IndexedDB quota) or switch to a storage with more capacity.","Close and recreate the database/storage; ensure no code closed the underlying RxStorage before addCollections.","If it appears after a RxDB upgrade, the on-disk data may be incompatible: migrate the data or start with cleared storage."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await db.addCollections(defs);\n} catch (err) {\n  if (isRxError(err) && err.code === 'DB12') {\n    const status = err.parameters?.writeError?.status;\n    console.error('Internal store write failed during addCollections, status:', status);\n  } else {\n    throw err;\n  }\n}","preventionTips":["Monitor browser storage quota (navigator.storage.estimate()) before large writes.","Never close the RxStorage or database before collection creation completes.","Upgrade RxDB and storages together; verify on-disk data compatibility across major versions.","Use the dev-mode plugin to see the underlying writeError parameters."],"tags":["storage-write","internal-store","quota"],"backgroundTag":"storage-write-failed","analyzedSha":"af6fb65f94cd70558d74c23799eda11ff1c15224","analyzedAt":"2026-08-31T23:32:37.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}