wtfutil/wtf · error
failed to parse command output '%s' as float64: %w
Error message
failed to parse command output '%s' as float64: %w
What it means
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.
Source
Thrown at modules/progress/widget.go:155
return title, widget.content(), false
})
}
func (widget *Widget) execValueCmd(cmd string) (float64, error) {
if widget.shell == "" {
return -1, errShellUndefined
}
out, err := exec.Command(widget.shell, "-c", cmd).Output()
if err != nil {
return -1, err
}
outStr := strings.TrimSpace(string(out))
val, err := strconv.ParseFloat(outStr, 64)
if err != nil {
return -1, fmt.Errorf("failed to parse command output '%s' as float64: %w", outStr, err)
}
return val, nil
}
func (widget *Widget) buildProgressBar(percent string) *progress.Model {
pOpts := []progress.Option{
progress.WithWidth(widget.calcBarWidth(percent)),
progress.WithoutPercentage(),
}
if widget.settings.solid != "" {
pOpts = append(pOpts, progress.WithSolidFill(widget.settings.solid))
} else {
pOpts = append(pOpts, progress.WithGradient(
widget.settings.gradientA,
widget.settings.gradientB,
))View on GitHub (pinned to bb838c1ccb)
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
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at modules/progress/widget.go:155 when the library encounters an invalid state.
Common situations: See trigger scenarios.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
AI-assisted analysis of wtfutil/wtf@bb838c1ccb (2026-09-03).
Data as JSON: /api/errors/a9625c56a71f43a7.
Report an issue: GitHub.