grafana/k6 · error
provided segment %s can't be found in sequence %s
Error message
provided segment %s can't be found in sequence %s
What it means
Raised by Options.Validate when an execution segment is configured (via K6_EXECUTION_SEGMENT) but that segment is not part of the specified execution segment sequence (K6_EXECUTION_SEGMENT_SEQUENCE), so the segment's boundaries are undefined for this run.
Source
Thrown at lib/options.go:540
o.DNS.Policy = opts.DNS.Policy
}
return o
}
// Validate checks if all of the specified options make sense
func (o Options) Validate() []error {
// TODO: validate all of the other options... that we should have already been validating...
// TODO: maybe integrate an external validation lib: https://github.com/avelino/awesome-go#validation
var validationErrors []error
if o.ExecutionSegmentSequence != nil {
var segmentFound bool
if slices.ContainsFunc(*o.ExecutionSegmentSequence, o.ExecutionSegment.Equal) {
segmentFound = true
}
if !segmentFound {
validationErrors = append(validationErrors,
fmt.Errorf("provided segment %s can't be found in sequence %s",
o.ExecutionSegment, o.ExecutionSegmentSequence))
}
}
validationErrors = append(validationErrors, o.Scenarios.Validate()...)
// Duration
if o.SetupTimeout.Valid && o.SetupTimeout.Duration <= 0 {
validationErrors = append(validationErrors, errors.New("setupTimeout must be positive"))
}
return validationErrors
}
// ForEachSpecified enumerates all struct fields and calls the supplied function with each
// element that is valid. It panics for any unfamiliar or unexpected fields, so make sure
// new fields in Options are accounted for.
func (o Options) ForEachSpecified(structTag string, callback func(key string, value any)) {
structType := reflect.TypeFor[Options]()
structVal := reflect.ValueOf(o)View on GitHub (pinned to 01ffac6f24)
Solutions
- Use a segment that appears in the configured sequence (e.g. 0:1/3 within 0:1/3,1/3:2/3,2/3:1:0)
- Ensure the sequence string is valid and complete so the segment can be found
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at lib/options.go:540 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/3d1083ad7a3ff059.
Report an issue: GitHub.