weaviate/weaviate · error
unexpected error, node size mismatch
Error message
unexpected error, node size mismatch
What it means
Before appending a replace-type node to the write-ahead log, the commit logger verifies that the serialized node buffer length equals the value range written into the key index (ki.ValueEnd-ki.ValueStart). A mismatch means the serializer wrote a different number of bytes than it recorded in the index, i.e. an internal serialization invariant was violated. The entry is rejected instead of writing a WAL record that later parsing could not decode.
Source
Thrown at adapters/repos/db/lsmkv/commitlogger.go:349
cl.n.Add(int64(1 + 1 + 4 + len(nodeBytes) + checksumSize))
return nil
}
func (cl *commitLogger) put(node segmentReplaceNode) error {
if cl.paused {
return nil
}
cl.bufNode.Reset()
ki, err := node.KeyIndexAndWriteTo(cl.bufNode)
if err != nil {
return err
}
if len(cl.bufNode.Bytes()) != ki.ValueEnd-ki.ValueStart {
return fmt.Errorf("unexpected error, node size mismatch")
}
return cl.writeEntry(CommitTypeReplace, cl.bufNode.Bytes())
}
func (cl *commitLogger) append(node segmentCollectionNode) error {
if cl.paused {
return nil
}
cl.bufNode.Reset()
ki, err := node.KeyIndexAndWriteTo(cl.bufNode)
if err != nil {
return err
}
if len(cl.bufNode.Bytes()) != ki.ValueEnd-ki.ValueStart {
return fmt.Errorf("unexpected error, node size mismatch")View on GitHub (pinned to 75aa4b6d11)
Solutions
- Retry the operation; if transient it indicates a race — check for concurrent writes to the same bucket
- Upgrade to the latest Weaviate version, as this guards against serializer bugs fixed upstream
- Capture the WAL file and report a bug with the object/key involved
- Verify the bucket's WAL files are not corrupted (truncated WAL can desync buffered state)
Defensive patterns
Strategy: retry
Try / catch
err := bucket.Put(ctx, []byte(key), value)
if err != nil {
if strings.Contains(err.Error(), "node size mismatch") {
// serialization invariant violated: do not spin; escalate
return fmt.Errorf("wal serializer invariant violated, please report: %w", err)
}
return err
} Prevention
- Run a single writer per bucket — never share buckets across goroutines/threads
- Keep Weaviate upgraded to pick up serializer fixes
- Do not hand-edit or truncate WAL files
- Watch logs for repeated mismatches and report with the WAL file attached
When it happens
Trigger: Calling commitlogger.Put with a segmentReplaceNode whose KeyIndexAndWriteTo serializes bytes inconsistent with its reported value range — a bug in the node serializer or a bufNode reused with stale contents.
Common situations: Encountered during development of lsmkv changes or on corrupted in-memory node state; practically never caused by user configuration.
Related errors
- primary index size mismatch: expected %d bytes, wrote %d
- write secondary index %d: %w
- flushing WAL %q: %w
- unsupported commit version %d
- unsupported commit version %d
AI-assisted analysis of weaviate/weaviate@75aa4b6d11 (2026-09-04).
Data as JSON: /api/errors/980ae7d5a05a6981.
Report an issue: GitHub.