{"record":{"id":"e57be14531473a3f","repo":"grafana/k6","slug":"segment-end-value-can-t-be-more-than-1-but-was-s","errorCode":null,"errorMessage":"segment end value can't be more than 1 but was %s","messagePattern":"segment end value can't be more than 1 but was (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/execution_segment.go","lineNumber":57,"sourceCode":"\n// Helpful \"constants\" so we don't initialize them in every function call\nvar (\n\tzeroRat, oneRat      = big.NewRat(0, 1), big.NewRat(1, 1) //nolint:gochecknoglobals\n\toneBigInt, twoBigInt = big.NewInt(1), big.NewInt(2)       //nolint:gochecknoglobals\n)\n\n// NewExecutionSegment validates the supplied arguments (basically, that 0 <=\n// from < to <= 1) and either returns an error, or it returns a\n// fully-initialized and usable execution segment.\nfunc NewExecutionSegment(from, to *big.Rat) (*ExecutionSegment, error) {\n\tif from.Cmp(zeroRat) < 0 {\n\t\treturn nil, fmt.Errorf(\"segment start value must be at least 0 but was %s\", from.FloatString(2))\n\t}\n\tif from.Cmp(to) >= 0 {\n\t\treturn nil, fmt.Errorf(\"segment start(%s) must be less than its end(%s)\", from.FloatString(2), to.FloatString(2))\n\t}\n\tif to.Cmp(oneRat) > 0 {\n\t\treturn nil, fmt.Errorf(\"segment end value can't be more than 1 but was %s\", to.FloatString(2))\n\t}\n\treturn newExecutionSegment(from, to), nil\n}\n\n// newExecutionSegment just creates an ExecutionSegment without validating the arguments\nfunc newExecutionSegment(from, to *big.Rat) *ExecutionSegment {\n\treturn &ExecutionSegment{\n\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)","sourceCodeStart":39,"sourceCodeEnd":75,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/lib/execution_segment.go#L39-L75","documentation":"NewExecutionSegment rejected a segment whose 'to' rational exceeds 1. It is the final boundary check of 0 <= from < to <= 1; segments represent fractions of the total workload and can never extend past 100%.","triggerScenarios":"Thrown at lib/execution_segment.go:57 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Keep segment end points <= 1, e.g. 1/2:1","Express smaller slices with fractions like 0:1/4 instead of values above 1"],"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-14T00:17:10.932Z"}