grafana/k6 · error

segment %d (%s) isn't present in the new sequence

Error message

segment %d (%s) isn't present in the new sequence

What it means

While generating a rescaled segment sequence, the tracked segment's scaled share became zero and was dropped from the new sequence, so its new index could not be found (newIndex stayed -1). Fires when the value being distributed is too small to give every segment a non-empty share.

Source

Thrown at lib/execution_segment.go:653

	newIndex = -1
	newESS := make(ExecutionSegmentSequence, 0, len(essw.ExecutionSegmentSequence)) // this can be smaller

	prev := int64(0)
	for i := range essw.ExecutionSegmentSequence {
		newValue := essw.ScaleInt64(i, value)
		if newValue == 0 {
			continue
		}
		currentES := newExecutionSegment(big.NewRat(prev, value), big.NewRat(prev+newValue, value))
		prev += newValue
		if i == trackedIndex {
			newIndex = len(newESS)
		}
		newESS = append(newESS, currentES)
	}

	if newIndex == -1 {
		return nil, -1, fmt.Errorf(
			"segment %d (%s) isn't present in the new sequence",
			trackedIndex, essw.ExecutionSegmentSequence[trackedIndex],
		)
	}

	return NewExecutionSegmentSequenceWrapper(newESS), newIndex, nil
}

// ExecutionTuple is the combination of an ExecutionSegmentSequence(Wrapper) and
// a specific ExecutionSegment from it. It gives easy access to the efficient
// scaling and striping algorithms for that specific segment, since the results
// are cached in the sequence wrapper. It is also the basis for the
// SegmentedIndex type below, which is the actual implementation of a segmented
// (striped) iterator, usable both for segmenting actual iterations and for
// partitioning data between multiple instances.
//
// For example, let's try to segment a load test in 3 unequal parts: 50%, 25%
// and 25% (so the ExecutionSegmentSequence will contain these segments: 0:1/2,

View on GitHub (pinned to 01ffac6f24)

Solutions

  1. Increase the total value (e.g. number of VUs) so each segment receives a non-zero share
  2. Reduce the number/granularity of execution segments so none scales down to zero
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at lib/execution_segment.go:653 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/de8eca8545436f5e. Report an issue: GitHub.