{"record":{"id":"ac2b454d40e860cb","repo":"golang/go","slug":"clause-q-has-d-elements-wanted-2","errorCode":null,"errorMessage":"clause %q has %d elements, wanted 2","messagePattern":"clause %q has (.+?) elements, wanted 2","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cmd/compile/internal/inline/inlheur/scoring.go","lineNumber":129,"sourceCode":"\t\tif adj.String() == s {\n\t\t\treturn adj, true\n\t\t}\n\t}\n\treturn 0, false\n}\n\nfunc parseScoreAdj(val string) error {\n\tclauses := strings.Split(val, \"/\")\n\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","sourceCodeStart":111,"sourceCodeEnd":147,"githubUrl":"https://github.com/golang/go/blob/b6b368adc57c96c3151d224d172029f233ead2c3/src/cmd/compile/internal/inline/inlheur/scoring.go#L111-L147","documentation":"Returned by parseScoreAdj when a clause splits into something other than exactly two colon-separated elements. Because the colon character itself can appear if the value contains a colon, this fires when there are 3+ elements, i.e. the clause has extra colons (e.g. name:value:extra).","triggerScenarios":"A clause like panicPathAdj:40:99 splits into 3 elements; len(elems) != 2 triggers the error reporting the actual element count.","commonSituations":"Compiler development: accidentally including a second colon, an extra value, or a trailing colon like panicPathAdj:40:.","solutions":["Ensure exactly one colon per clause with a single integer after it.","Remove stray characters or extra segments after the value.","Validate by mentally splitting on \":\" — the result must be a 2-element slice."],"exampleFix":"// before\n-d=inlheuradjustments=panicPathAdj:40:99\n// after\n-d=inlheuradjustments=panicPathAdj:40","handlingStrategy":"validation","validationCode":"// Ensure exactly two elements per clause.\nfor _, c := range strings.Split(val, \"/\") {\n    if len(strings.Split(c, \":\")) != 2 {\n        return fmt.Errorf(\"clause %q must be name:value\", c)\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Avoid extra colons in either the name or the value.","Use integers only for the value half."],"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"}