grafana/k6 · error
segment start value must be at least 0 but was %s
Error message
segment start value must be at least 0 but was %s
What it means
NewExecutionSegment rejected a segment whose 'from' rational is negative. It is the first of three boundary checks (0 <= from < to <= 1); this one fires when the lower bound of the segment is below zero, which can only come from a bad --execution-segment value or programmatic misuse.
Source
Thrown at lib/execution_segment.go:51
// Ensure we implement those interfaces
var (
_ encoding.TextUnmarshaler = &ExecutionSegment{}
_ fmt.Stringer = &ExecutionSegment{}
)
// Helpful "constants" so we don't initialize them in every function call
var (
zeroRat, oneRat = big.NewRat(0, 1), big.NewRat(1, 1) //nolint:gochecknoglobals
oneBigInt, twoBigInt = big.NewInt(1), big.NewInt(2) //nolint:gochecknoglobals
)
// NewExecutionSegment validates the supplied arguments (basically, that 0 <=
// from < to <= 1) and either returns an error, or it returns a
// fully-initialized and usable execution segment.
func NewExecutionSegment(from, to *big.Rat) (*ExecutionSegment, error) {
if from.Cmp(zeroRat) < 0 {
return nil, fmt.Errorf("segment start value must be at least 0 but was %s", from.FloatString(2))
}
if from.Cmp(to) >= 0 {
return nil, fmt.Errorf("segment start(%s) must be less than its end(%s)", from.FloatString(2), to.FloatString(2))
}
if to.Cmp(oneRat) > 0 {
return nil, fmt.Errorf("segment end value can't be more than 1 but was %s", to.FloatString(2))
}
return newExecutionSegment(from, to), nil
}
// newExecutionSegment just creates an ExecutionSegment without validating the arguments
func newExecutionSegment(from, to *big.Rat) *ExecutionSegment {
return &ExecutionSegment{
from: from,
to: to,
length: new(big.Rat).Sub(to, from),
}
}View on GitHub (pinned to 01ffac6f24)
Solutions
- Use a start value >= 0, e.g. 0:1/2 for the first half of the test
- Check the --execution-segment CLI flag or segment strings in options for a leading negative value
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at lib/execution_segment.go:51 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/87d58d8c8c35b24f.
Report an issue: GitHub.