{"record":{"id":"a9625c56a71f43a7","repo":"wtfutil/wtf","slug":"failed-to-parse-command-output-s-as-float64-w","errorCode":null,"errorMessage":"failed to parse command output '%s' as float64: %w","messagePattern":"failed to parse command output '(.+?)' as float64: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"modules/progress/widget.go","lineNumber":155,"sourceCode":"\t\treturn title, widget.content(), false\n\t})\n}\n\nfunc (widget *Widget) execValueCmd(cmd string) (float64, error) {\n\tif widget.shell == \"\" {\n\t\treturn -1, errShellUndefined\n\t}\n\n\tout, err := exec.Command(widget.shell, \"-c\", cmd).Output()\n\tif err != nil {\n\t\treturn -1, err\n\t}\n\n\toutStr := strings.TrimSpace(string(out))\n\n\tval, err := strconv.ParseFloat(outStr, 64)\n\tif err != nil {\n\t\treturn -1, fmt.Errorf(\"failed to parse command output '%s' as float64: %w\", outStr, err)\n\t}\n\n\treturn val, nil\n}\n\nfunc (widget *Widget) buildProgressBar(percent string) *progress.Model {\n\tpOpts := []progress.Option{\n\t\tprogress.WithWidth(widget.calcBarWidth(percent)),\n\t\tprogress.WithoutPercentage(),\n\t}\n\n\tif widget.settings.solid != \"\" {\n\t\tpOpts = append(pOpts, progress.WithSolidFill(widget.settings.solid))\n\t} else {\n\t\tpOpts = append(pOpts, progress.WithGradient(\n\t\t\twidget.settings.gradientA,\n\t\t\twidget.settings.gradientB,\n\t\t))","sourceCodeStart":137,"sourceCodeEnd":173,"githubUrl":"https://github.com/wtfutil/wtf/blob/bb838c1ccb0f0f3223690df44afdec663d622881/modules/progress/widget.go#L137-L173","documentation":"Raised in execValueCmd when strconv.ParseFloat fails on the trimmed stdout of a configured value command (minimum/maximum/current): the command ran successfully but its output is not a plain numeric value (e.g. text, units, or multiple lines), so it cannot be converted to float64.","triggerScenarios":"Thrown at modules/progress/widget.go:155 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Adjust the command so it outputs only a bare number (strip units/labels, e.g. via awk or cut)","Check the command's output for warnings or logs mixed into stdout","Trim extra whitespace/characters the command emits","Test the exact command with $SHELL -c '<cmd>' to confirm the output parses as a float"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"bb838c1ccb0f0f3223690df44afdec663d622881","analyzedAt":"2026-09-03T17:02:45.030Z","contentChangedAt":"2026-09-03T17:02:45.030Z","schemaVersion":2},"datasetVersion":"2026-09-11T00:17:11.886Z"}