{"record":{"id":"0c6ef77444ddb182","repo":"golang/go","slug":"clause-q-malformed-value-v","errorCode":null,"errorMessage":"clause %q: malformed value: %v","messagePattern":"clause %q: malformed value: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cmd/compile/internal/inline/inlheur/scoring.go","lineNumber":138,"sourceCode":"\tif len(clauses) == 0 {\n\t\treturn fmt.Errorf(\"no clauses\")\n\t}\n\tfor _, clause := range clauses {\n\t\telems := strings.Split(clause, \":\")\n\t\tif len(elems) < 2 {\n\t\t\treturn fmt.Errorf(\"clause %q: expected colon\", clause)\n\t\t}\n\t\tif len(elems) != 2 {\n\t\t\treturn fmt.Errorf(\"clause %q has %d elements, wanted 2\", clause,\n\t\t\t\tlen(elems))\n\t\t}\n\t\tadj, ok := adjStringToVal(elems[0])\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"clause %q: unknown adjustment\", clause)\n\t\t}\n\t\tval, err := strconv.Atoi(elems[1])\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"clause %q: malformed value: %v\", clause, err)\n\t\t}\n\t\tadjValues[adj] = val\n\t}\n\treturn nil\n}\n\nfunc adjValue(x scoreAdjustTyp) int {\n\tif val, ok := adjValues[x]; ok {\n\t\treturn val\n\t} else {\n\t\tpanic(\"internal error unregistered adjustment type\")\n\t}\n}\n\nvar mayMustAdj = [...]struct{ may, must scoreAdjustTyp }{\n\t{may: passConstToNestedIfAdj, must: passConstToIfAdj},\n\t{may: passConcreteToNestedItfCallAdj, must: passConcreteToItfCallAdj},\n\t{may: passFuncToNestedIndCallAdj, must: passFuncToNestedIndCallAdj},","sourceCodeStart":120,"sourceCodeEnd":156,"githubUrl":"https://github.com/golang/go/blob/b6b368adc57c96c3151d224d172029f233ead2c3/src/cmd/compile/internal/inline/inlheur/scoring.go#L120-L156","documentation":"Returned by parseScoreAdj when strconv.Atoi fails to parse the value portion of a clause. Each clause is name:integer; if the integer half is non-numeric, Atoi returns an error that is wrapped into the clause-specific message.","triggerScenarios":"A clause like panicPathAdj:high or panicPathAdj:4.0 where elems[1] is not a base-10 integer; strconv.Atoi returns err and parseScoreAdj wraps it.","commonSituations":"Compiler development: typo in the value, using a float, or pasting a value with surrounding whitespace/signs Atoi rejects.","solutions":["Use a plain decimal integer for the value (panicPathAdj:40).","Strip whitespace and any sign/unit suffixes from the value.","If negative tuning is intended, use the signed form Atoi accepts (e.g. panicPathAdj:-5)."],"exampleFix":"// before\n-d=inlheuradjustments=panicPathAdj:high\n// after\n-d=inlheuradjustments=panicPathAdj:40","handlingStrategy":"validation","validationCode":"// Atoi-validate the value half up front.\nfor _, c := range strings.Split(val, \"/\") {\n    parts := strings.SplitN(c, \":\", 2)\n    if _, err := strconv.Atoi(parts[1]); err != nil {\n        return fmt.Errorf(\"value %q must be an integer\", parts[1])\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use plain decimal integers (optionally signed) for adjustment values.","Avoid floats, units, or whitespace in the value."],"tags":["go-compiler","inline-heuristics","flag-parsing","internal"],"analyzedSha":"b6b368adc57c96c3151d224d172029f233ead2c3","analyzedAt":"2026-08-12T00:22:02.250Z","schemaVersion":2},"datasetVersion":"2026-08-12T12:17:08.281Z"}