wagoodman/dive · error
invalid %s config value, given %q: %v
Error message
invalid %s config value, given %q: %v
What it means
Returned while parsing the CI rule config when the value for lowestEfficiencyThreshold cannot be parsed by strconv.ParseFloat as a 64-bit float. This is strict config validation: the string must be a plain decimal number (optionally with a leading sign/exponent); percent signs, commas, and fractions like 90/100 are rejected.
Source
Thrown at cmd/dive/cli/internal/command/ci/rules.go:101
type HighestWastedBytesRule struct {
BaseRule
threshold uint64
}
// HighestUserWastedPercentRule checks if percentage of wasted bytes is below threshold
type HighestUserWastedPercentRule struct {
BaseRule
threshold float64
}
func NewLowestEfficiencyRule(configValue string) (Rule, error) {
if isRuleDisabled(configValue) {
return DisabledRule(ciKeyLowestEfficiencyThreshold), nil
}
threshold, err := strconv.ParseFloat(configValue, 64)
if err != nil {
return nil, fmt.Errorf("invalid %s config value, given %q: %v",
ciKeyLowestEfficiencyThreshold, configValue, err)
}
if threshold < 0 || threshold > 1 {
return nil, fmt.Errorf("%s config value is outside allowed range (0-1), given '%f'",
ciKeyLowestEfficiencyThreshold, threshold)
}
return &LowestEfficiencyRule{
BaseRule: BaseRule{
key: ciKeyLowestEfficiencyThreshold,
configValue: configValue,
},
threshold: threshold,
}, nil
}
func (r *LowestEfficiencyRule) Evaluate(analysis *image.Analysis) (RuleStatus, string) {View on GitHub (pinned to d6c691947f)
Solutions
- Change the value to a plain decimal fraction between 0 and 1, e.g. lowestEfficiencyThreshold: 0.9
- Remove any % sign — the threshold is a fraction, not a percentage
- Quote the YAML value ("0.9") to avoid type coercion surprises
- To disable the rule entirely, use the documented disabled sentinel value instead of junk text
Example fix
# before rules: lowestEfficiencyThreshold: "90%" # after rules: lowestEfficiencyThreshold: "0.9"
Defensive patterns
Strategy: validation
Validate before calling
// validate all fraction-typed rule values before constructing rules
if _, err := strconv.ParseFloat(cfg.LowestEfficiencyThreshold, 64); err != nil {
return fmt.Errorf("lowestEfficiencyThreshold must be a decimal fraction like 0.9: %w", err)
} Type guard
func isValidFraction(s string) bool {
f, err := strconv.ParseFloat(s, 64)
return err == nil && f >= 0 && f <= 1
} Try / catch
rule, err := ci.NewLowestEfficiencyRule(value)
if err != nil {
if strings.Contains(err.Error(), "invalid lowestEfficiencyThreshold") {
// config author error: point at the config file + expected format
}
return err
} Prevention
- Use fractions (0.9), never percentages, in CI rule configs
- Add a config-lint CI step that parses every threshold before merge
- Quote numeric strings in YAML to avoid implicit type coercion
When it happens
Trigger: Setting lowestEfficiencyThreshold: "0.9" is valid; values like "90%", "0,9", "1e", or "" (empty but not disabled) fail ParseFloat and produce this error at rule-construction time, before any image is analyzed.
Common situations: Copy-pasted CI configs using percent notation ("95%" instead of "0.95"); locales using comma decimals; YAML unquoted values that serialize oddly; leaving a placeholder string in the config.
Related errors
- invalid highestUserWastedPercent config value, given %q: %v
- %s config value is outside allowed range (0-1), given '%f'
- invalid highestWastedBytes config value, given %q: %v
- highestUserWastedPercent config value is outside allowed ran
- evaluation failed
AI-assisted analysis of wagoodman/dive@d6c691947f (2026-08-15).
Data as JSON: /api/errors/0d7c4c40559fb86d.
Report an issue: GitHub.