{"record":{"id":"bd22b0c0ece4c11e","repo":"siyuan-note/siyuan","slug":"view-state-patch-cannot-be-split-within-the-storag","errorCode":null,"errorMessage":"View state patch cannot be split within the storage limits","messagePattern":"View state patch cannot be split within the storage limits","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/src/util/viewState.ts","lineNumber":232,"sourceCode":"            }\n            values[field] = value;\n            this.pendingValues.delete(field);\n            count++;\n        }\n        if (count < MAX_PATCH_ENTRIES && this.pendingValues.size === 0) {\n            for (const field of this.pendingRemovals) {\n                const nextRemoveKeys = [...removeKeys, field];\n                if (count > 0 && (count >= MAX_PATCH_ENTRIES ||\n                    getPatchByteLength(values, nextRemoveKeys) > MAX_PATCH_BYTES)) {\n                    break;\n                }\n                removeKeys.push(field);\n                this.pendingRemovals.delete(field);\n                count++;\n            }\n        }\n        if (count === 0) {\n            throw new Error(\"View state patch cannot be split within the storage limits\");\n        }\n        return {values, removeKeys};\n    }\n\n    private validateValue(field: string, value: TViewStateValue) {\n        if (getPatchByteLength({[field]: value}, []) > MAX_PATCH_BYTES) {\n            throw new Error(\"View state value is too large\");\n        }\n    }\n\n    private scheduleFlush() {\n        this.clearFlushTimer();\n        this.flushTimer = setTimeout(() => {\n            this.flushTimer = undefined;\n            this.flush().catch((error) => console.error(error));\n        }, this.flushDelay);\n    }\n","sourceCodeStart":214,"sourceCodeEnd":250,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/8641553a1f07374001902d3ce773285db1292b2d/app/src/util/viewState.ts#L214-L250","documentation":"takePendingBatch guard in the view-state service: even a single pending entry exceeds MAX_PATCH_ENTRIES/MAX_PATCH_BYTES limits, so the batch cannot be split into any valid patch that fits the storage constraints. One field value alone is too large to persist.","triggerScenarios":"Thrown at app/src/util/viewState.ts:232 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Reduce the size of individual stored values below the patch byte limit","Move large blobs out of view state into dedicated storage","Split oversized logical state into multiple independently keyed surfaces"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"8641553a1f07374001902d3ce773285db1292b2d","analyzedAt":"2026-09-11T16:08:28.414Z","contentChangedAt":"2026-09-11T16:08:28.414Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}