{"record":{"id":"c1996f7f9d02345f","repo":"pubkey/rxdb","slug":"qu10-c1996f","errorCode":"QU10","errorMessage":"\n        RxDB Error-Code: ${message}.\n        Hint: Error messages are not included in RxDB core to reduce build size.\n        To show the full error messages and to ensure that you do not make any mistakes when using RxDB,\n        use the dev-mode plugin when you are in development mode: https://rxdb.info/dev-mode.html?console=error\n        \nFind out more about this error here: https://rxdb.info/errors.html?console=errors#QU10 \nStill stuck? Ask in the RxDB Discord: https://rxdb.info/chat \n","messagePattern":"\n        RxDB Error-Code: (.+?)\\.\n        Hint: Error messages are not included in RxDB core to reduce build size\\.\n        To show the full error messages and to ensure that you do not make any mistakes when using RxDB,\n        use the dev-mode plugin when you are in development mode: https://rxdb\\.info/dev-mode\\.html\\?console=error\n        \nFind out more about this error here: https://rxdb\\.info/errors\\.html\\?console=errors#QU10 \nStill stuck\\? Ask in the RxDB Discord: https://rxdb\\.info/chat \n","errorType":"error_code","errorClass":"RxError","httpStatus":null,"severity":"error","filePath":"src/rx-query.ts","lineNumber":528,"sourceCode":"            if (result.error.length > 0) {\n                throw rxStorageWriteErrorToRxError(result.error[0]);\n            } else {\n                return result.success as any;\n            }\n        } else if (docs instanceof Map) {\n            const docsArray = [...docs.values()];\n            const result = await this.collection.bulkRemove(docsArray as any);\n            if (result.error.length > 0) {\n                throw rxStorageWriteErrorToRxError(result.error[0]);\n            }\n            const resultMap = new Map();\n            result.success.forEach((doc: any) => resultMap.set(doc.primary, doc));\n            return resultMap as any;\n        } else {\n            // findOne() can return null when no document matches\n            if (!docs) {\n                if (throwIfMissing) {\n                    throw newRxError('QU10', {\n                        collection: this.collection.name,\n                        query: this.mangoQuery,\n                        op: this.op\n                    });\n                }\n                return null as any;\n            }\n            return (docs as any).remove();\n        }\n    }\n    incrementalRemove(): Promise<RxQueryResult> {\n        return runQueryUpdateFunction(\n            this.asRxQuery,\n            (doc) => doc.incrementalRemove(),\n        );\n    }\n\n","sourceCodeStart":510,"sourceCodeEnd":546,"githubUrl":"https://github.com/pubkey/rxdb/blob/af6fb65f94cd70558d74c23799eda11ff1c15224/src/rx-query.ts#L510-L546","documentation":"findOne().remove(throwIfMissing) throws QU10 when no document matches the query and throwIfMissing was set. It tells you the document you asked to delete does not exist. Without throwIfMissing, remove() just returns null for a missing document.","triggerScenarios":"collection.findOne(id).remove(true) after the document was already deleted; deleting by a selector that no longer matches (e.g. status changed); a race where another client removed the doc between lookup and remove.","commonSituations":"Delete-then-retry flows that hit the second delete; idempotent cleanup jobs processing stale id lists; tests asserting existence that no longer holds after replication pulls deletes.","solutions":["Call remove() without arguments and handle the null return if absence is acceptable.","Check existence with findOne().exec() before calling remove(true).","Treat QU10 as an already-deleted success in idempotent flows."],"exampleFix":"// before\nawait collection.findOne(id).remove(true);\n// after (idempotent delete)\nconst doc = await collection.findOne(id).exec();\nif (doc) { await doc.remove(); }","handlingStrategy":"try-catch","validationCode":"const doc = await collection.findOne(id).exec();\nif (doc) { await doc.remove(); } // otherwise treat as already deleted","typeGuard":"function isMissingDocument(err: any): boolean {\n  return err?.code === 'QU10';\n}","tryCatchPattern":"try {\n  await collection.findOne(id).remove(true);\n} catch (err) {\n  if (err.code === 'QU10') {\n    // already deleted, idempotent success\n  } else { throw err; }\n}","preventionTips":["Drop throwIfMissing in cleanup/idempotent delete paths and accept null.","Check existence with findOne().exec() when the flow needs to distinguish missing vs deleted.","Remember replication can pull remote deletes at any time; never assume a fetched id still exists."],"tags":["rxquery","findone","document-missing"],"backgroundTag":"document-not-found","analyzedSha":"af6fb65f94cd70558d74c23799eda11ff1c15224","analyzedAt":"2026-08-31T23:32:37.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}