{"record":{"id":"6d19f64586d87450","repo":"kataras/iris","slug":"s-s-w","errorCode":null,"errorMessage":"<%s = %s>: %w","messagePattern":"<(.+?) = (.+?)>: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"i18n/internal/locale.go","lineNumber":116,"sourceCode":"\tvar (\n\t\trenderer, pluralRenderer Renderer = m, m\n\t)\n\n\tif stringIsTemplateValue(value, loc.Options.Left, loc.Options.Right) {\n\t\tt, err := NewTemplate(c, m)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tpluralRenderer = t\n\t\tif !isPlural {\n\t\t\trenderer = t\n\t\t}\n\t} else {\n\t\tif isPlural {\n\t\t\tpluralRenderer, err = newIndependentPluralRenderer(c, loc, key, msgs...)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"<%s = %s>: %w\", key, value, err)\n\t\t\t}\n\t\t} else if err = c.Set(loc.tag, key, msgs...); err != nil {\n\t\t\t// let's make normal keys direct fire:\n\t\t\t// renderer = &simpleRenderer{key, loc.Printer}\n\t\t\treturn fmt.Errorf(\"<%s = %s>: %w\", key, value, err)\n\t\t}\n\n\t}\n\n\tif isPlural {\n\t\tif existingMsg, ok := loc.Messages[key]; ok {\n\t\t\tif msg, ok := existingMsg.(*Message); ok {\n\t\t\t\tmsg.AddPlural(form, pluralRenderer)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\tm.AddPlural(form, pluralRenderer)","sourceCodeStart":98,"sourceCodeEnd":134,"githubUrl":"https://github.com/kataras/iris/blob/7bedaf55a0b64bbb2248a5845a2c60d81a30996a/i18n/internal/locale.go#L98-L134","documentation":"i18n's setString registers a message key for a locale. When the value is plural (a PluralForm was given) it builds an independent plural renderer via newIndependentPluralRenderer; if that fails, the underlying go-i18n catalog/plural error is wrapped as \"<key = value>: err\". It means the plural rule or message syntax for this plural key could not be compiled/registered in the underlying catalog.","triggerScenarios":"Calling Set/Set plural variants (e.g. loc.Set with PluralForm) where newIndependentPluralRenderer returns an error — typically a malformed plural message string (invalid select/plural syntax) or an invalid plural form for the language tag.","commonSituations":"Translation files or inline messages with broken plural templates (e.g. mismatched braces in {{.Var}} or invalid plural cases), plural keys declared with forms the language's plural rules do not accept, or copy-pasted plural rules between languages with different CLDR categories.","solutions":["Fix the plural message string syntax for the key shown in the error (check braces and plural cases).","Verify the PluralForm used matches the locale's CLDR plural categories (one, other, few...).","Check the wrapped inner error (%w) for the exact catalog/plural parse failure and address it.","Set DefaultMessageFunc or test the key with a minimal message to isolate the failing syntax."],"exampleFix":"// before\nloc.Set(\"en-US\", \"dogs\", \"You have %d dog|one:dog|many:dogs\", i18n.Plural(\"many\"))\n// after (valid CLDR form + syntax)\nloc.Set(\"en-US\", \"dogs\", \"You have %d dog|one:dog|other:dogs\", i18n.Plural(\"other\"))","handlingStrategy":"validation","validationCode":"// validate plural message before Set\nif strings.Contains(value, \"|\") && form == nil {\n    return fmt.Errorf(\"key %q: plural syntax used without a PluralForm\", key)\n}\n// ensure value braces are balanced\nif strings.Count(value, \"{{\") != strings.Count(value, \"}}\") {\n    return fmt.Errorf(\"key %q: unbalanced template braces\", key)\n}","typeGuard":null,"tryCatchPattern":"if err := loc.Set(tag, key, msgs...); err != nil {\n    var perr error\n    if errors.As(err, &perr) {\n        log.Printf(\"plural registration failed for %s: %v\", key, perr)\n    }\n    return err\n}","preventionTips":["Always register an \"other\" (fallback) plural form for every plural key.","Keep plural message syntax consistent per language's CLDR categories.","Run a startup test that Sets and Renders every key for every locale.","Fail fast at load time instead of at request time."],"tags":["i18n","go","plural","message-syntax"],"backgroundTag":"i18n-message-registration-failed","analyzedSha":"7bedaf55a0b64bbb2248a5845a2c60d81a30996a","analyzedAt":"2026-08-30T20:38:16.250Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}