nats-io/nats-server · error

incomplete type, value pair

Error message

incomplete type, value pair

What it means

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.

Source

Thrown at internal/ldap/dn.go:182

			} else if n != 1 {
				return nil, fmt.Errorf("expected 1 byte when un-escaping, got %d", n)
			}
			buffer.WriteByte(dst[0])
			i++
		case char == '\\':
			unescapedTrailingSpaces = 0
			escaping = true
		case char == '=':
			attribute.Type = stringFromBuffer()
			// Special case: If the first character in the value is # the following data
			// is BER encoded. Throw an error since not supported right now.
			if len(str) > i+1 && str[i+1] == '#' {
				return nil, errors.New("unsupported BER encoding")
			}
		case char == ',' || char == '+':
			// We're done with this RDN or value, push it
			if len(attribute.Type) == 0 {
				return nil, errors.New("incomplete type, value pair")
			}
			attribute.Value = stringFromBuffer()
			rdn.Attributes = append(rdn.Attributes, attribute)
			attribute = new(AttributeTypeAndValue)
			if char == ',' {
				dn.RDNs = append(dn.RDNs, rdn)
				rdn = new(RelativeDN)
				rdn.Attributes = make([]*AttributeTypeAndValue, 0)
			}
		case char == ' ' && buffer.Len() == 0:
			// ignore unescaped leading spaces
			continue
		default:
			if char == ' ' {
				// Track unescaped spaces in case they are trailing and we need to remove them
				unescapedTrailingSpaces++
			} else {
				// Reset if we see a non-space char

View on GitHub (pinned to 3a66a489d2)

Solutions

  1. Fix the state computation so AckFloor.Consumer never exceeds Delivered.Consumer
  2. Clamp AckFloor.Consumer to Delivered.Consumer before calling Update
  3. Validate the ConsumerState invariants before submitting (see validation code)

Example fix

// before
st.AckFloor.Consumer = 100; st.Delivered.Consumer = 90
consumer.Update(st)
// after
if st.AckFloor.Consumer > st.Delivered.Consumer {
    st.AckFloor.Consumer = st.Delivered.Consumer
}
consumer.Update(st)
Defensive patterns

Strategy: validation

Validate before calling

if st.AckFloor.Consumer > st.Delivered.Consumer {
    return fmt.Errorf("invalid consumer state: ack floor %d > delivered %d",
        st.AckFloor.Consumer, st.Delivered.Consumer)
}
consumer.Update(st)

Try / catch

if err := consumer.Update(st); err != nil {
    if strings.Contains(err.Error(), "bad ack floor") {
        // clamp or re-derive state before retrying
    }
}

Prevention

When it happens

Trigger: Calling consumerMemStore.Update(state) where state.AckFloor.Consumer > state.Delivered.Consumer.

Common situations: Bug in consumer state computation before persisting; corrupted state loaded from an older server version; custom tooling hand-crafting ConsumerState structs.

Related errors


AI-assisted analysis of nats-io/nats-server@3a66a489d2 (2026-09-02). Data as JSON: /api/errors/ed44297df12d380a. Report an issue: GitHub.