{"record":{"id":"0d7c4c40559fb86d","repo":"wagoodman/dive","slug":"invalid-s-config-value-given-q-v","errorCode":null,"errorMessage":"invalid %s config value, given %q: %v","messagePattern":"invalid (.+?) config value, given %q: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/dive/cli/internal/command/ci/rules.go","lineNumber":101,"sourceCode":"type HighestWastedBytesRule struct {\n\tBaseRule\n\tthreshold uint64\n}\n\n// HighestUserWastedPercentRule checks if percentage of wasted bytes is below threshold\ntype HighestUserWastedPercentRule struct {\n\tBaseRule\n\tthreshold float64\n}\n\nfunc NewLowestEfficiencyRule(configValue string) (Rule, error) {\n\tif isRuleDisabled(configValue) {\n\t\treturn DisabledRule(ciKeyLowestEfficiencyThreshold), nil\n\t}\n\n\tthreshold, err := strconv.ParseFloat(configValue, 64)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"invalid %s config value, given %q: %v\",\n\t\t\tciKeyLowestEfficiencyThreshold, configValue, err)\n\t}\n\n\tif threshold < 0 || threshold > 1 {\n\t\treturn nil, fmt.Errorf(\"%s config value is outside allowed range (0-1), given '%f'\",\n\t\t\tciKeyLowestEfficiencyThreshold, threshold)\n\t}\n\n\treturn &LowestEfficiencyRule{\n\t\tBaseRule: BaseRule{\n\t\t\tkey:         ciKeyLowestEfficiencyThreshold,\n\t\t\tconfigValue: configValue,\n\t\t},\n\t\tthreshold: threshold,\n\t}, nil\n}\n\nfunc (r *LowestEfficiencyRule) Evaluate(analysis *image.Analysis) (RuleStatus, string) {","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/wagoodman/dive/blob/d6c691947f8fda635c952a17ee3b7555379d58f0/cmd/dive/cli/internal/command/ci/rules.go#L83-L119","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"# before\nrules:\n  lowestEfficiencyThreshold: \"90%\"\n\n# after\nrules:\n  lowestEfficiencyThreshold: \"0.9\"","handlingStrategy":"validation","validationCode":"// validate all fraction-typed rule values before constructing rules\nif _, err := strconv.ParseFloat(cfg.LowestEfficiencyThreshold, 64); err != nil {\n    return fmt.Errorf(\"lowestEfficiencyThreshold must be a decimal fraction like 0.9: %w\", err)\n}","typeGuard":"func isValidFraction(s string) bool {\n    f, err := strconv.ParseFloat(s, 64)\n    return err == nil && f >= 0 && f <= 1\n}","tryCatchPattern":"rule, err := ci.NewLowestEfficiencyRule(value)\nif err != nil {\n    if strings.Contains(err.Error(), \"invalid lowestEfficiencyThreshold\") {\n        // config author error: point at the config file + expected format\n    }\n    return err\n}","preventionTips":["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"],"tags":["ci","config","validation","parsing","rules"],"backgroundTag":null,"analyzedSha":"d6c691947f8fda635c952a17ee3b7555379d58f0","analyzedAt":"2026-08-15T09:42:35.293Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}