{"record":{"id":"de8eca8545436f5e","repo":"grafana/k6","slug":"segment-d-s-isn-t-present-in-the-new-sequence","errorCode":null,"errorMessage":"segment %d (%s) isn't present in the new sequence","messagePattern":"segment (.+?) \\((.+?)\\) isn't present in the new sequence","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/execution_segment.go","lineNumber":653,"sourceCode":"\tnewIndex = -1\n\tnewESS := make(ExecutionSegmentSequence, 0, len(essw.ExecutionSegmentSequence)) // this can be smaller\n\n\tprev := int64(0)\n\tfor i := range essw.ExecutionSegmentSequence {\n\t\tnewValue := essw.ScaleInt64(i, value)\n\t\tif newValue == 0 {\n\t\t\tcontinue\n\t\t}\n\t\tcurrentES := newExecutionSegment(big.NewRat(prev, value), big.NewRat(prev+newValue, value))\n\t\tprev += newValue\n\t\tif i == trackedIndex {\n\t\t\tnewIndex = len(newESS)\n\t\t}\n\t\tnewESS = append(newESS, currentES)\n\t}\n\n\tif newIndex == -1 {\n\t\treturn nil, -1, fmt.Errorf(\n\t\t\t\"segment %d (%s) isn't present in the new sequence\",\n\t\t\ttrackedIndex, essw.ExecutionSegmentSequence[trackedIndex],\n\t\t)\n\t}\n\n\treturn NewExecutionSegmentSequenceWrapper(newESS), newIndex, nil\n}\n\n// ExecutionTuple is the combination of an ExecutionSegmentSequence(Wrapper) and\n// a specific ExecutionSegment from it. It gives easy access to the efficient\n// scaling and striping algorithms for that specific segment, since the results\n// are cached in the sequence wrapper. It is also the basis for the\n// SegmentedIndex type below, which is the actual implementation of a segmented\n// (striped) iterator, usable both for segmenting actual iterations and for\n// partitioning data between multiple instances.\n//\n// For example, let's try to segment a load test in 3 unequal parts: 50%, 25%\n// and 25% (so the ExecutionSegmentSequence will contain these segments: 0:1/2,","sourceCodeStart":635,"sourceCodeEnd":671,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/lib/execution_segment.go#L635-L671","documentation":"While generating a rescaled segment sequence, the tracked segment's scaled share became zero and was dropped from the new sequence, so its new index could not be found (newIndex stayed -1). Fires when the value being distributed is too small to give every segment a non-empty share.","triggerScenarios":"Thrown at lib/execution_segment.go:653 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Increase the total value (e.g. number of VUs) so each segment receives a non-zero share","Reduce the number/granularity of execution segments so none scales down to zero"],"exampleFix":null,"handlingStrategy":"fallback","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"}