siyuan-note/siyuan · error

View state patch cannot be split within the storage limits

Error message

View state patch cannot be split within the storage limits

What it means

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.

Source

Thrown at app/src/util/viewState.ts:232

            }
            values[field] = value;
            this.pendingValues.delete(field);
            count++;
        }
        if (count < MAX_PATCH_ENTRIES && this.pendingValues.size === 0) {
            for (const field of this.pendingRemovals) {
                const nextRemoveKeys = [...removeKeys, field];
                if (count > 0 && (count >= MAX_PATCH_ENTRIES ||
                    getPatchByteLength(values, nextRemoveKeys) > MAX_PATCH_BYTES)) {
                    break;
                }
                removeKeys.push(field);
                this.pendingRemovals.delete(field);
                count++;
            }
        }
        if (count === 0) {
            throw new Error("View state patch cannot be split within the storage limits");
        }
        return {values, removeKeys};
    }

    private validateValue(field: string, value: TViewStateValue) {
        if (getPatchByteLength({[field]: value}, []) > MAX_PATCH_BYTES) {
            throw new Error("View state value is too large");
        }
    }

    private scheduleFlush() {
        this.clearFlushTimer();
        this.flushTimer = setTimeout(() => {
            this.flushTimer = undefined;
            this.flush().catch((error) => console.error(error));
        }, this.flushDelay);
    }

View on GitHub (pinned to 8641553a1f)

Solutions

  1. Reduce the size of individual stored values below the patch byte limit
  2. Move large blobs out of view state into dedicated storage
  3. Split oversized logical state into multiple independently keyed surfaces
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at app/src/util/viewState.ts:232 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of siyuan-note/siyuan@8641553a1f (2026-09-11). Data as JSON: /api/errors/bd22b0c0ece4c11e. Report an issue: GitHub.