larksuite/cli · error
codeMeta dup: code %d already mapped %+v; %s wants %+v
Error message
codeMeta dup: code %d already mapped %+v; %s wants %+v
What it means
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.
Source
Thrown at internal/errclass/codemeta.go:89
21000: {Category: errs.CategoryPolicy, Subtype: errs.SubtypeChallengeRequired},
21001: {Category: errs.CategoryPolicy, Subtype: errs.SubtypeAccessDenied},
}
// LookupCodeMeta is the single lookup entry. Returns ok=false for unknown codes —
// the caller (BuildAPIError) is responsible for falling back to
// CategoryAPI/SubtypeUnknown.
func LookupCodeMeta(code int) (CodeMeta, bool) {
m, ok := codeMeta[code]
return m, ok
}
// mergeCodeMeta is invoked by sub-table init() functions to merge service-specific
// codes into the central registry. Panics on duplicate code so a misregistration
// fails fast at startup rather than producing silently-inconsistent classification.
func mergeCodeMeta(src map[int]CodeMeta, owner string) {
for code, meta := range src {
if existing, dup := codeMeta[code]; dup {
panic(fmt.Sprintf("codeMeta dup: code %d already mapped %+v; %s wants %+v",
code, existing, owner, meta))
}
codeMeta[code] = meta
}
}
View on GitHub (pinned to 7fd6ef3c07)
Solutions
- Give the duplicate code a single owning table before release
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at internal/errclass/codemeta.go:89 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of larksuite/cli@7fd6ef3c07 (2026-09-04).
Data as JSON: /api/errors/2b83e9e34f2d4e94.
Report an issue: GitHub.