kataras/iris · error
key: %q: no registered plurals for <%d>
Error message
key: %q: no registered plurals for <%d>
What it means
When rendering a plural Message, the library finds the plural count from the first argument and searches m.Plurals for a registered PluralForm whose rules match that count. If none matches, Render returns "key: %q: no registered plurals for <%d>". This means the count is valid but no plural form was registered that covers it.
Source
Thrown at i18n/internal/message.go:73
// Render completes the Renderer interface.
// It accepts arguments, which can resolve the pluralization type of the message
// and its variables. If the Message is wrapped by a Template then the
// first argument should be a map. The map key resolves to the pluralization
// of the message is the "PluralCount". And for variables the user
// should set a message key which looks like: %VAR_NAME%Count, e.g. "DogsCount"
// to set plural count for the "Dogs" variable, case-sensitive.
func (m *Message) Render(args ...any) (string, error) {
if m.Plural {
if len(args) > 0 {
if pluralCount, ok := findPluralCount(args[0]); ok {
for _, plural := range m.Plurals {
if plural.Form.MatchPlural(pluralCount) {
return plural.Renderer.Render(args...)
}
}
return "", fmt.Errorf("key: %q: no registered plurals for <%d>", m.Key, pluralCount)
}
}
return "", fmt.Errorf("key: %q: missing plural count argument", m.Key)
}
return m.Locale.Printer.Sprintf(m.Key, args...), nil
}
View on GitHub (pinned to 7bedaf55a0)
Solutions
- Register the missing plural form(s) for the key — ensure "other" is always defined as a fallback.
- Verify the language's CLDR plural categories and add all required forms (e.g. few/many for ru, zero/one/two/few/many for ar).
- Check findPluralCount behavior: pass the count as the first Render argument as a plain number.
- Provide a DefaultMessageFunc to fall back to the default language message when a form is missing.
Example fix
// before (en-US style forms on ru locale) "apples": "one:%d яблоко|other:%d яблок" // after "apples": "one:%d яблоко|few:%d яблока|many:%d яблок|other:%d яблока"
Defensive patterns
Strategy: fallback
Validate before calling
// ensure counts you will render are covered
for _, n := range []int{0, 1, 2, 5, 100, 1000} {
if _, err := msg.Render(n); err != nil {
log.Printf("key %s uncovered for count %d: %v", key, n, err)
}
} Try / catch
s, err := tr.Render(n)
if err != nil && strings.Contains(err.Error(), "no registered plurals") {
s, err = tr.Render(1) // fallback to a covered form
} Prevention
- Always define the "other" plural form as a catch-all.
- For Slavic/Arabic locales, register all CLDR forms (few, many, zero...).
- Smoke-test rendering with edge counts (0, 1, 2, large numbers).
- Use DefaultMessageFunc to fall back to default language messages.
When it happens
Trigger: Calling Render/T with a plural key and a numeric count (e.g. 0, 2, 100) for which no PluralForm was registered — e.g. only "one" and "other" forms were defined but the language requires "few"/"many" (Russian, Arabic) or the count falls outside registered ranges.
Common situations: Incomplete translation files missing plural cases for a language, counts like 0 or 2 hitting unregistered forms in Slavic/Arabic locales, or custom PluralFormDecoder mismatching the registered forms.
Related errors
- <%s = %s>: %w
- key: %q: missing plural count argument
- nil loader
- catalog: empty languages
- expected language index to be lower or equal than %d but got
AI-assisted analysis of kataras/iris@7bedaf55a0 (2026-08-30).
Data as JSON: /api/errors/97ad33ab14ff66f2.
Report an issue: GitHub.