{"record":{"id":"fe3f1310d21e820a","repo":"grafana/k6","slug":"segment-start-s-must-be-less-than-its-end-s","errorCode":null,"errorMessage":"segment start(%s) must be less than its end(%s)","messagePattern":"segment start\\((.+?)\\) must be less than its end\\((.+?)\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/execution_segment.go","lineNumber":54,"sourceCode":"\t_ encoding.TextUnmarshaler = &ExecutionSegment{}\n\t_ fmt.Stringer             = &ExecutionSegment{}\n)\n\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.","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/lib/execution_segment.go#L36-L72","documentation":"NewExecutionSegment rejected a segment whose start is not strictly less than its end (from >= to). It is the second boundary check of 0 <= from < to <= 1 — the segment would have zero or negative length, making VU striping math invalid.","triggerScenarios":"Thrown at lib/execution_segment.go:54 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Write the segment with the smaller point first, e.g. 1/2:1 not 1:1/2","Remember the empty 100% segment is written as 0:1, and a lone value like 1/2 means 1/2: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"}