weaviate/weaviate · error
write secondary key %d
Error message
write secondary key %d
What it means
For each secondary index j of a segment node, the key length and (if non-zero) key bytes are serialized. This error wraps a failed Write of secondary key j's bytes, meaning I/O to the segment file failed mid-record; the node is left incomplete and the error aborts serialization.
Source
Thrown at adapters/repos/db/lsmkv/segment_serialization.go:110
secondaryKeyLength = uint32(len(s.secondaryKeys[j]))
}
// write the key length in any case
binary.LittleEndian.PutUint32(buf[0:4], secondaryKeyLength)
if _, err := w.Write(buf[0:4]); err != nil {
return out, err
}
written += 4
if secondaryKeyLength == 0 {
// we're done here
continue
}
// only write the key if it exists
n, err = w.Write(s.secondaryKeys[j])
if err != nil {
return out, errors.Wrapf(err, "write secondary key %d", j)
}
written += n
}
return segmentindex.Key{
ValueStart: s.offset,
ValueEnd: s.offset + written,
Key: s.primaryKey,
SecondaryKeys: s.secondaryKeys,
}, nil
}
func ParseReplaceNode(r io.Reader, secondaryIndexCount uint16) (segmentReplaceNode, error) {
out := segmentReplaceNode{}
// 9 bytes is the most we can ever read uninterrupted, i.e. without a dynamic
// read in between.
tmpBuf := make([]byte, 9)View on GitHub (pinned to 75aa4b6d11)
Solutions
- Inspect the wrapped writer error for storage problems
- Retry the flush/compaction producing the segment
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at adapters/repos/db/lsmkv/segment_serialization.go:110 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of weaviate/weaviate@75aa4b6d11 (2026-09-04).
Data as JSON: /api/errors/1c68821af46c1933.
Report an issue: GitHub.