{"record":{"id":"1c68821af46c1933","repo":"weaviate/weaviate","slug":"write-secondary-key-d","errorCode":null,"errorMessage":"write secondary key %d","messagePattern":"write secondary key (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"adapters/repos/db/lsmkv/segment_serialization.go","lineNumber":110,"sourceCode":"\t\t\tsecondaryKeyLength = uint32(len(s.secondaryKeys[j]))\n\t\t}\n\n\t\t// write the key length in any case\n\t\tbinary.LittleEndian.PutUint32(buf[0:4], secondaryKeyLength)\n\t\tif _, err := w.Write(buf[0:4]); err != nil {\n\t\t\treturn out, err\n\t\t}\n\t\twritten += 4\n\n\t\tif secondaryKeyLength == 0 {\n\t\t\t// we're done here\n\t\t\tcontinue\n\t\t}\n\n\t\t// only write the key if it exists\n\t\tn, err = w.Write(s.secondaryKeys[j])\n\t\tif err != nil {\n\t\t\treturn out, errors.Wrapf(err, \"write secondary key %d\", j)\n\t\t}\n\t\twritten += n\n\t}\n\n\treturn segmentindex.Key{\n\t\tValueStart:    s.offset,\n\t\tValueEnd:      s.offset + written,\n\t\tKey:           s.primaryKey,\n\t\tSecondaryKeys: s.secondaryKeys,\n\t}, nil\n}\n\nfunc ParseReplaceNode(r io.Reader, secondaryIndexCount uint16) (segmentReplaceNode, error) {\n\tout := segmentReplaceNode{}\n\n\t// 9 bytes is the most we can ever read uninterrupted, i.e. without a dynamic\n\t// read in between.\n\ttmpBuf := make([]byte, 9)","sourceCodeStart":92,"sourceCodeEnd":128,"githubUrl":"https://github.com/weaviate/weaviate/blob/75aa4b6d11f8818305aafd4440b4e32794f7ca04/adapters/repos/db/lsmkv/segment_serialization.go#L92-L128","documentation":"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.","triggerScenarios":"Thrown at adapters/repos/db/lsmkv/segment_serialization.go:110 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the wrapped writer error for storage problems","Retry the flush/compaction producing the segment"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"75aa4b6d11f8818305aafd4440b4e32794f7ca04","analyzedAt":"2026-09-04T14:58:20.392Z","contentChangedAt":"2026-09-04T14:58:20.392Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}