{"record":{"id":"4bd1db22baa1d54d","repo":"apache/beam","slug":"values-below-minimum-value-v-v","errorCode":null,"errorMessage":"values below minimum value %v: %v","messagePattern":"values below minimum value (.+?): (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/testing/passert/floats.go","lineNumber":151,"sourceCode":"\t\tif val < f.Lo {\n\t\t\ttooLow = append(tooLow, val)\n\t\t} else if val > f.Hi {\n\t\t\ttooHigh = append(tooHigh, val)\n\t\t}\n\t}\n\tif len(tooLow)+len(tooHigh) == 0 {\n\t\treturn nil\n\t}\n\terrorStrings := []string{}\n\tif len(tooLow) != 0 {\n\t\tsort.Float64s(tooLow)\n\t\terrorStrings = append(errorStrings, fmt.Sprintf(\"values below minimum value %v: %v\", f.Lo, tooLow))\n\t}\n\tif len(tooHigh) != 0 {\n\t\tsort.Float64s(tooHigh)\n\t\terrorStrings = append(errorStrings, fmt.Sprintf(\"values above maximum value %v: %v\", f.Hi, tooHigh))\n\t}\n\treturn errors.New(strings.Join(errorStrings, \"\\n\"))\n}\n\nfunc toFloat(input beam.T) float64 {\n\treturn reflect.ValueOf(input.(any)).Convert(reflectx.Float64).Interface().(float64)\n}\n\nfunc validateNonComplexNumber(t reflect.Type) error {\n\tif !reflectx.IsNumber(t) || reflectx.IsComplex(t) {\n\t\treturn errors.Errorf(\"type must be a non-complex number: %v\", t)\n\t}\n\treturn nil\n}\n","sourceCodeStart":133,"sourceCodeEnd":164,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/testing/passert/floats.go#L133-L164","documentation":"passert.AllWithinBounds's ProcessElement collects observed values outside the [Lo, Hi] range; values under the minimum are sorted and reported as 'values below minimum value %v: %v', listing Lo and the offending values. It fails the assertion when the PCollection contains any element outside the specified bounds.","triggerScenarios":"Calling passert.AllWithinBounds(s, col, lo, hi) where at least one observed value is < lo — e.g. negative values where only non-negatives were expected.","commonSituations":"Validating metric PCollections (percentages, counts) that unexpectedly go out of range; divide/aggregation bugs producing out-of-range numbers; unsorted outliers reported verbatim in the error.","solutions":["Inspect the listed out-of-range values to find the producing stage","Fix upstream logic so values respect the bounds (clamping, validation ParDo)","Adjust lo/hi arguments if the intended bounds were wrong (note the function swaps flipped bounds already)","Add a filter/validator transform if out-of-range values are expected to be dropped"],"exampleFix":"// before\npassert.AllWithinBounds(s, ratios, 0.0, 1.0) // values below minimum value 0: [-0.02]\n// after\nsafe := beam.ParDo(s, &clampToUnitIntervalFn{}, ratios)\npassert.AllWithinBounds(s, safe, 0.0, 1.0)","handlingStrategy":"validation","validationCode":"// pre-filter or clamp values that may exceed bounds before asserting\nclamped := beam.ParDo(s, &clampFn{Lo: 0.0, Hi: 1.0}, col)","typeGuard":null,"tryCatchPattern":"if got := assertAllWithinBounds(col, 0.0, 1.0); got != nil {\n\tt.Fatalf(\"out-of-bounds values: %v\", got)\n}","preventionTips":["Validate value ranges in a dedicated ParDo before the assertion","Remember AllWithinBounds swaps flipped lo/hi arguments — pass them in order","Inspect the sorted offending values list to find the producing transform","Drop or clamp expected outliers with a filter transform"],"tags":["go","beam","testing","passert","bounds"],"backgroundTag":"value-out-of-range","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}