{"record":{"id":"e111ee87b6c8828d","repo":"grafana/k6","slug":"invalid-percentile-trend-stat-value-s-provide","errorCode":null,"errorMessage":"invalid percentile trend stat value '%s', provide a number between 0 and 100","messagePattern":"invalid percentile trend stat value '(.+?)', provide a number between 0 and 100","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"metrics/sample.go","lineNumber":182,"sourceCode":"\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresult[stat] = dynamicResolver(percentile)\n\t}\n\n\treturn result, nil\n}\n\n// parsePercentile is a helper function to parse and validate percentile notations\nfunc parsePercentile(stat string) (float64, error) {\n\tif !strings.HasPrefix(stat, \"p(\") || !strings.HasSuffix(stat, \")\") {\n\t\treturn 0, fmt.Errorf(\"invalid trend stat '%s', unknown format\", stat)\n\t}\n\n\tpercentile, err := strconv.ParseFloat(stat[2:len(stat)-1], 64)\n\n\tif err != nil || (percentile < 0) || (percentile > 100) {\n\t\treturn 0, fmt.Errorf(\"invalid percentile trend stat value '%s', provide a number between 0 and 100\", stat)\n\t}\n\n\treturn percentile, nil\n}\n","sourceCodeStart":164,"sourceCodeEnd":187,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/metrics/sample.go#L164-L187","documentation":"Raised by parsePercentile when a p(...) trend stat's inner value fails to parse as a float or falls outside the 0–100 range. Reached only after the p(...) format check has passed.","triggerScenarios":"Thrown at metrics/sample.go:182 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a number between 0 and 100 inside p(), e.g. p(99.9)","Avoid negative values or values over 100"],"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-14T05:17:10.506Z"}