{"record":{"id":"d1cafe6a59188d6b","repo":"kataras/iris","slug":"locales-not-found-in-s","errorCode":null,"errorMessage":"locales not found in %s","messagePattern":"locales not found in (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"i18n/loader.go","lineNumber":205,"sourceCode":"\n\t\t\t\tb, err := asset(fileName)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\n\t\t\t\tif err = unmarshal(b, &keyValues); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t}\n\n\t\t\terr = cat.Store(langIndex, keyValues)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\n\t\tif n := len(cat.Locales); n == 0 {\n\t\t\treturn nil, fmt.Errorf(\"locales not found in %s\", strings.Join(assetNames, \", \"))\n\t\t} else if options.Strict && n < len(m.Languages) {\n\t\t\treturn nil, fmt.Errorf(\"locales expected to be %d but %d parsed\", len(m.Languages), n)\n\t\t}\n\n\t\treturn cat, nil\n\t}\n}\n\nfunc unmarshalINI(data []byte, v any) error {\n\tf, err := ini.Load(data)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tm := *v.(*map[string]any)\n\n\t// Includes the ini.DefaultSection which has the root keys too.\n\t// We don't have to iterate to each section to find the subsection,","sourceCodeStart":187,"sourceCodeEnd":223,"githubUrl":"https://github.com/kataras/iris/blob/7bedaf55a0b64bbb2248a5845a2c60d81a30996a/i18n/loader.go#L187-L223","documentation":"The file-based loader (load, used by i18n.Glob/FS/Assets) parses locale files matched by assetNames and stores them per language. If after loading all files cat.Locales is empty, it returns \"locales not found in <file1, file2, ...>\". This means none of the asset files matched a registered language or none produced a stored locale.","triggerScenarios":"Calling i18n.Glob(\"./locales/*/*.yaml\") (or FS/Assets) where ParseLanguageFiles found no files matching the registered languages' tags — filenames lack language names, wrong directory layout, or registered languages don't appear in any filename.","commonSituations":"Naming files locale-en.yml instead of en.yml (pattern the parser doesn't expect), files in a layout Glob doesn't match, embedded FS paths differing from local paths, or New registered with languages absent from the folder.","solutions":["Check the listed asset names and rename files so they contain a registered language tag (e.g. locales/en-US.yml).","Verify the Glob/FS pattern actually matches the files (print the matched names).","Ensure the languages passed to New/i18n match the file language tags.","Confirm embedded FS (go:embed) paths are relative to the embed root as expected."],"exampleFix":"// before (unrecognized names)\nlocales/locale-en-US.yaml\n// after\nlocales/en-US.yaml","handlingStrategy":"validation","validationCode":"// verify files match expected naming before load\nmatches, _ := filepath.Glob(\"./locales/*.yaml\")\nif len(matches) == 0 {\n    return fmt.Errorf(\"no locale files found in ./locales\")\n}\nfor _, f := range matches {\n    base := filepath.Base(f)\n    if !strings.Contains(base, \"en\") {\n        log.Printf(\"warning: %s does not encode a language tag\", base)\n    }\n}","typeGuard":null,"tryCatchPattern":"localizer, err := i18n.Glob(\"./locales/*/*.yaml\")(matcher)\nif err != nil && strings.Contains(err.Error(), \"locales not found in\") {\n    return fmt.Errorf(\"no locale files matched registered languages: %w\", err)\n}","preventionTips":["Name files with the language tag: en-US.yaml, el-GR.ini.","Verify Glob/embed patterns match the actual directory layout.","Keep file language tags in sync with languages registered in New.","Log matched asset names during load to catch naming drift."],"tags":["i18n","go","loader","files"],"backgroundTag":"no-locales-loaded","analyzedSha":"7bedaf55a0b64bbb2248a5845a2c60d81a30996a","analyzedAt":"2026-08-30T20:38:16.250Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}