grafana/k6 · error

the start value %s of segment #%d must be equal to the end v

Error message

the start value %s of segment #%d must be equal to the end value of the previous one, but it is %s

What it means

NewExecutionSegmentSequence found a gap or overlap: a segment's start does not equal the previous segment's end. A valid sequence must be contiguous (the end of one segment is exactly the beginning of the next), so non-adjacent bounds are rejected.

Source

Thrown at lib/execution_segment.go:310

	return new(big.Rat).Mul(value, es.length)
}

// ExecutionSegmentSequence represents an ordered chain of execution segments,
// where the end of one segment is the beginning of the next. It can serialized
// as a comma-separated string of rational numbers "r1,r2,r3,...,rn", which
// represents the sequence (r1, r2], (r2, r3], (r3, r4], ..., (r{n-1}, rn].
// The empty value should be treated as if there is a single (0, 1] segment.
type ExecutionSegmentSequence []*ExecutionSegment

// NewExecutionSegmentSequence validates the that the supplied execution
// segments are non-overlapping and without gaps. It will return a new execution
// segment sequence if that is true, and an error if it's not.
func NewExecutionSegmentSequence(segments ...*ExecutionSegment) (ExecutionSegmentSequence, error) {
	if len(segments) > 1 {
		to := segments[0].to
		for i, segment := range segments[1:] {
			if segment.from.Cmp(to) != 0 {
				return nil, fmt.Errorf(
					"the start value %s of segment #%d must be equal to the end value of the previous one, but it is %s",
					segment.from, i+1, to,
				)
			}
			to = segment.to
		}
	}
	return ExecutionSegmentSequence(segments), nil
}

// NewExecutionSegmentSequenceFromString parses strings of the format
// "r1,r2,r3,...,rn", which represents the sequences like (r1, r2], (r2, r3],
// (r3, r4], ..., (r{n-1}, rn].
func NewExecutionSegmentSequenceFromString(strSeq string) (ExecutionSegmentSequence, error) {
	if len(strSeq) == 0 {
		return nil, nil
	}

View on GitHub (pinned to 01ffac6f24)

Solutions

  1. Make consecutive segments share boundaries, e.g. 0:1/3,1/3:2/3,2/3:1
  2. Verify every internal point appears exactly twice in the sequence string
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at lib/execution_segment.go:310 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of grafana/k6@01ffac6f24 (2026-08-18). Data as JSON: /api/errors/39bb03835db4ad29. Report an issue: GitHub.