{"record":{"id":"90ce0518ebe21d5e","repo":"grafana/k6","slug":"cannot-generate-new-sequence-for-value-d","errorCode":null,"errorMessage":"cannot generate new sequence for value %d","messagePattern":"cannot generate new sequence for value (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/execution_segment.go","lineNumber":628,"sourceCode":"}\n\n// GetNewExecutionSegmentSequenceFromValue uses the value provided, splits it\n// between all the segments, using the striping offsets in the sequence,\n// generating a new segment sequence. It then returns a new\n// ExecutionSegmentSequenceWrapper, with the new sequence and segments, such\n// that each new segment in the new sequence has length `Scale(value)/value`\n// while keeping the order.\n//\n// Additionally, the position of a given segment index can be tracked (since\n// empty segments are removed), so that you can reconstruct an ExecutionTuple,\n// if required. If the segment with the trackedIndex is not part of the new\n// sequence, or if a new sequence cannot be generated (for example, for 0\n// values), an error will be returned.\nfunc (essw *ExecutionSegmentSequenceWrapper) GetNewExecutionSegmentSequenceFromValue(value int64, trackedIndex int) (\n\tnewSequence *ExecutionSegmentSequenceWrapper, newIndex int, err error,\n) {\n\tif value < 1 {\n\t\treturn nil, -1, fmt.Errorf(\"cannot generate new sequence for value %d\", value)\n\t}\n\n\tif value%essw.lcd == 0 { // the value is perfectly divisible so we will get the same tuple\n\t\treturn essw, trackedIndex, nil\n\t}\n\n\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 {","sourceCodeStart":610,"sourceCodeEnd":646,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/lib/execution_segment.go#L610-L646","documentation":"GetNewExecutionSegmentSequenceFromValue could not distribute the given value across the segment sequence — the striping/scaling arithmetic yielded no valid new sequence for that total. An internal consistency guard in ExecutionTuple redistribution (used when rescaling work across a new VU count).","triggerScenarios":"Thrown at lib/execution_segment.go:628 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a value (total VU/iteration count) that can be distributed across the configured segments","Simplify the execution segment configuration if redistribution keeps failing"],"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-14T05:17:10.506Z"}