{"record":{"id":"61371d1b364f5730","repo":"golang/go","slug":"clause-q-unknown-adjustment","errorCode":null,"errorMessage":"clause %q: unknown adjustment","messagePattern":"clause %q: unknown adjustment","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cmd/compile/internal/inline/inlheur/scoring.go","lineNumber":134,"sourceCode":"}\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\n\t} else {\n\t\tpanic(\"internal error unregistered adjustment type\")\n\t}\n}\n","sourceCodeStart":116,"sourceCodeEnd":152,"githubUrl":"https://github.com/golang/go/blob/b6b368adc57c96c3151d224d172029f233ead2c3/src/cmd/compile/internal/inline/inlheur/scoring.go#L116-L152","documentation":"Returned by parseScoreAdj when the first element of a clause is not a recognized scoreAdjustTyp name. adjStringToVal walks the bit-flag enum and matches by its String() method; if no enum value's name equals elems[0], the adjustment is treated as unknown.","triggerScenarios":"A clause like FooAdj:40 where FooAdj is not one of panicPathAdj, initFuncAdj, inLoopAdj, passConstToIfAdj, etc.; adjStringToVal returns ok=false and parseScoreAdj reports the unknown adjustment.","commonSituations":"Compiler development: typo in adjustment name, using an outdated name after a rename, or copy-pasting a name from a different Go version whose enum differs.","solutions":["Use only adjustment names defined in the scoreAdjustTyp const block (panicPathAdj, initFuncAdj, inLoopAdj, passConstToIfAdj, passConstToNestedIfAdj, passConcreteToItfCallAdj, passConcreteToNestedItfCallAdj, passFuncToIndCallAdj, passFuncToNestedIndCallAdj, passInlinableFuncToIndCallAdj, passInlinableFuncToNestedIndCallAdj, returnFeedsConstToIfAdj, returnFeedsFuncToIndCallAdj, returnFeedsInlinableFuncToIndCallAdj, returnFeedsConcreteToInterfaceCallAdj).","Run adjStringToVal on the candidate name to confirm before passing the flag.","Update the name to match the current Go tree if it was renamed."],"exampleFix":"// before\n-d=inlheuradjustments=panicPath:40\n// after\n-d=inlheuradjustments=panicPathAdj:40","handlingStrategy":"validation","validationCode":"// Build the set of valid adjustment names once.\nvalid := map[string]bool{}\nfor adj := scoreAdjustTyp(1); adj < sentinelScoreAdj; adj <<= 1 {\n    valid[adj.String()] = true\n}\nfor _, c := range strings.Split(val, \"/\") {\n    name := strings.SplitN(c, \":\", 2)[0]\n    if !valid[name] {\n        return fmt.Errorf(\"unknown adjustment %q\", name)\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Source adjustment names from the scoreAdjustTyp String() outputs only.","Update flag docs whenever the enum is renamed."],"tags":["go-compiler","inline-heuristics","flag-parsing","internal"],"backgroundTag":null,"analyzedSha":"b6b368adc57c96c3151d224d172029f233ead2c3","analyzedAt":"2026-08-12T00:22:02.250Z","schemaVersion":2},"datasetVersion":"2026-08-12T12:31:55.035Z"}