{"record":{"id":"2b83e9e34f2d4e94","repo":"larksuite/cli","slug":"codemeta-dup-code-d-already-mapped-v-s-wants","errorCode":null,"errorMessage":"codeMeta dup: code %d already mapped %+v; %s wants %+v","messagePattern":"codeMeta dup: code (.+?) already mapped %\\+v; (.+?) wants %\\+v","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/errclass/codemeta.go","lineNumber":89,"sourceCode":"\t21000: {Category: errs.CategoryPolicy, Subtype: errs.SubtypeChallengeRequired},\n\t21001: {Category: errs.CategoryPolicy, Subtype: errs.SubtypeAccessDenied},\n}\n\n// LookupCodeMeta is the single lookup entry. Returns ok=false for unknown codes —\n// the caller (BuildAPIError) is responsible for falling back to\n// CategoryAPI/SubtypeUnknown.\nfunc LookupCodeMeta(code int) (CodeMeta, bool) {\n\tm, ok := codeMeta[code]\n\treturn m, ok\n}\n\n// mergeCodeMeta is invoked by sub-table init() functions to merge service-specific\n// codes into the central registry. Panics on duplicate code so a misregistration\n// fails fast at startup rather than producing silently-inconsistent classification.\nfunc mergeCodeMeta(src map[int]CodeMeta, owner string) {\n\tfor code, meta := range src {\n\t\tif existing, dup := codeMeta[code]; dup {\n\t\t\tpanic(fmt.Sprintf(\"codeMeta dup: code %d already mapped %+v; %s wants %+v\",\n\t\t\t\tcode, existing, owner, meta))\n\t\t}\n\t\tcodeMeta[code] = meta\n\t}\n}\n","sourceCodeStart":71,"sourceCodeEnd":95,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/internal/errclass/codemeta.go#L71-L95","documentation":"mergeCodeMeta, called from sub-table init() functions, detected that a service-specific API code is already mapped in the central codeMeta registry - two tables claim the same numeric code. It panics so misregistration fails at startup rather than silently at lookup time.","triggerScenarios":"Thrown at internal/errclass/codemeta.go:89 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Give the duplicate code a single owning table before release"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7fd6ef3c07182257ce776cdc5a614e122d5bd4b3","analyzedAt":"2026-09-04T21:17:44.649Z","contentChangedAt":"2026-09-04T21:17:44.649Z","schemaVersion":2},"datasetVersion":"2026-09-12T02:17:10.037Z"}