{"record":{"id":"f62cde943ad46c50","repo":"grafana/k6","slug":"s-is-not-a-valid-percentage-decimal-fraction","errorCode":null,"errorMessage":"'%s' is not a valid percentage, decimal, fraction or interval value","messagePattern":"'(.+?)' is not a valid percentage, decimal, fraction or interval value","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/execution_segment.go","lineNumber":83,"sourceCode":"\t\tfrom:   from,\n\t\tto:     to,\n\t\tlength: new(big.Rat).Sub(to, from),\n\t}\n}\n\n// stringToRat is a helper function that tries to convert a string to a rational\n// number while allowing percentage, decimal, and fraction values.\nfunc stringToRat(s string) (*big.Rat, error) {\n\tif before, ok := strings.CutSuffix(s, \"%\"); ok {\n\t\tnum, ok := new(big.Int).SetString(before, 10)\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"'%s' is not a valid percentage\", s)\n\t\t}\n\t\treturn new(big.Rat).SetFrac(num, big.NewInt(100)), nil\n\t}\n\trat, ok := new(big.Rat).SetString(s)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"'%s' is not a valid percentage, decimal, fraction or interval value\", s)\n\t}\n\treturn rat, nil\n}\n\n// NewExecutionSegmentFromString validates the supplied string value and returns\n// the newly created ExecutionSegment or and error from it.\n//\n// We are able to parse both single percentage/float/fraction values, and actual\n// (from: to] segments. For the single values, we just treat them as the\n// beginning segment - thus the execution segment can be used as a shortcut for\n// quickly running an arbitrarily scaled-down version of a test.\n//\n// The parsing logic is that values with a colon, i.e. ':', are full segments:\n//\n//\t`1/2:3/4`, `0.5:0.75`, `50%:75%`, and even `2/4:75%` should be (1/2, 3/4]\n//\n// And values without a colon are the end of a first segment:\n//","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/lib/execution_segment.go#L65-L101","documentation":"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.","triggerScenarios":"Thrown at lib/execution_segment.go:83 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"01ffac6f245854c1b8adc6a69857c76a15f90022","analyzedAt":"2026-08-18T03:05:52.393Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}