grafana/k6 · error
'%s' is not a valid percentage, decimal, fraction or interva
Error message
'%s' is not a valid percentage, decimal, fraction or interval value
What it means
stringToRat failed to interpret the segment point as any supported format: the string has no '%' suffix and big.Rat.SetString could not parse it as a decimal or fraction. Segment points must be percentages, decimals, or fractions like 1/2 — anything else (e.g. 'abc', '1..2') lands here.
Source
Thrown at lib/execution_segment.go:83
from: from,
to: to,
length: new(big.Rat).Sub(to, from),
}
}
// stringToRat is a helper function that tries to convert a string to a rational
// number while allowing percentage, decimal, and fraction values.
func stringToRat(s string) (*big.Rat, error) {
if before, ok := strings.CutSuffix(s, "%"); ok {
num, ok := new(big.Int).SetString(before, 10)
if !ok {
return nil, fmt.Errorf("'%s' is not a valid percentage", s)
}
return new(big.Rat).SetFrac(num, big.NewInt(100)), nil
}
rat, ok := new(big.Rat).SetString(s)
if !ok {
return nil, fmt.Errorf("'%s' is not a valid percentage, decimal, fraction or interval value", s)
}
return rat, nil
}
// NewExecutionSegmentFromString validates the supplied string value and returns
// the newly created ExecutionSegment or and error from it.
//
// We are able to parse both single percentage/float/fraction values, and actual
// (from: to] segments. For the single values, we just treat them as the
// beginning segment - thus the execution segment can be used as a shortcut for
// quickly running an arbitrarily scaled-down version of a test.
//
// The parsing logic is that values with a colon, i.e. ':', are full segments:
//
// `1/2:3/4`, `0.5:0.75`, `50%:75%`, and even `2/4:75%` should be (1/2, 3/4]
//
// And values without a colon are the end of a first segment:
//View on GitHub (pinned to 01ffac6f24)
Solutions
- Use one of the accepted forms: percent (25%), decimal (0.25) or fraction (1/4)
- Check for typos, stray spaces, or empty points between commas in the segment string
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at lib/execution_segment.go:83 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/f62cde943ad46c50.
Report an issue: GitHub.