{"record":{"id":"ed44297df12d380a","repo":"nats-io/nats-server","slug":"incomplete-type-value-pair","errorCode":null,"errorMessage":"incomplete type, value pair","messagePattern":"incomplete type, value pair","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/ldap/dn.go","lineNumber":182,"sourceCode":"\t\t\t} else if n != 1 {\n\t\t\t\treturn nil, fmt.Errorf(\"expected 1 byte when un-escaping, got %d\", n)\n\t\t\t}\n\t\t\tbuffer.WriteByte(dst[0])\n\t\t\ti++\n\t\tcase char == '\\\\':\n\t\t\tunescapedTrailingSpaces = 0\n\t\t\tescaping = true\n\t\tcase char == '=':\n\t\t\tattribute.Type = stringFromBuffer()\n\t\t\t// Special case: If the first character in the value is # the following data\n\t\t\t// is BER encoded. Throw an error since not supported right now.\n\t\t\tif len(str) > i+1 && str[i+1] == '#' {\n\t\t\t\treturn nil, errors.New(\"unsupported BER encoding\")\n\t\t\t}\n\t\tcase char == ',' || char == '+':\n\t\t\t// We're done with this RDN or value, push it\n\t\t\tif len(attribute.Type) == 0 {\n\t\t\t\treturn nil, errors.New(\"incomplete type, value pair\")\n\t\t\t}\n\t\t\tattribute.Value = stringFromBuffer()\n\t\t\trdn.Attributes = append(rdn.Attributes, attribute)\n\t\t\tattribute = new(AttributeTypeAndValue)\n\t\t\tif char == ',' {\n\t\t\t\tdn.RDNs = append(dn.RDNs, rdn)\n\t\t\t\trdn = new(RelativeDN)\n\t\t\t\trdn.Attributes = make([]*AttributeTypeAndValue, 0)\n\t\t\t}\n\t\tcase char == ' ' && buffer.Len() == 0:\n\t\t\t// ignore unescaped leading spaces\n\t\t\tcontinue\n\t\tdefault:\n\t\t\tif char == ' ' {\n\t\t\t\t// Track unescaped spaces in case they are trailing and we need to remove them\n\t\t\t\tunescapedTrailingSpaces++\n\t\t\t} else {\n\t\t\t\t// Reset if we see a non-space char","sourceCodeStart":164,"sourceCodeEnd":200,"githubUrl":"https://github.com/nats-io/nats-server/blob/3a66a489d262bf89b71a71c955c94920394532f3/internal/ldap/dn.go#L164-L200","documentation":"Returned by consumerMemStore.Update when the incoming ConsumerState's AckFloor.Consumer exceeds Delivered.Consumer. The ack floor (lowest unacknowledged sequence boundary) can never be ahead of the delivered sequence, so the state is inconsistent and is rejected without applying it. This protects the in-memory consumer state from corruption.","triggerScenarios":"Calling consumerMemStore.Update(state) where state.AckFloor.Consumer > state.Delivered.Consumer.","commonSituations":"Bug in consumer state computation before persisting; corrupted state loaded from an older server version; custom tooling hand-crafting ConsumerState structs.","solutions":["Fix the state computation so AckFloor.Consumer never exceeds Delivered.Consumer","Clamp AckFloor.Consumer to Delivered.Consumer before calling Update","Validate the ConsumerState invariants before submitting (see validation code)"],"exampleFix":"// before\nst.AckFloor.Consumer = 100; st.Delivered.Consumer = 90\nconsumer.Update(st)\n// after\nif st.AckFloor.Consumer > st.Delivered.Consumer {\n    st.AckFloor.Consumer = st.Delivered.Consumer\n}\nconsumer.Update(st)","handlingStrategy":"validation","validationCode":"if st.AckFloor.Consumer > st.Delivered.Consumer {\n    return fmt.Errorf(\"invalid consumer state: ack floor %d > delivered %d\",\n        st.AckFloor.Consumer, st.Delivered.Consumer)\n}\nconsumer.Update(st)","typeGuard":null,"tryCatchPattern":"if err := consumer.Update(st); err != nil {\n    if strings.Contains(err.Error(), \"bad ack floor\") {\n        // clamp or re-derive state before retrying\n    }\n}","preventionTips":["Validate ConsumerState invariants in one helper before every Update","Advance AckFloor and Delivered together in the same critical section","Fuzz state-serialization round-trips to catch floor corruption"],"tags":["jetstream","consumer-state","validation"],"backgroundTag":"invalid-ack-floor","analyzedSha":"3a66a489d262bf89b71a71c955c94920394532f3","analyzedAt":"2026-09-02T04:41:54.247Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}