flutter gen-l10n stops because it cannot read the ARB file
The 'template-arb-file', app_en.arb, is not readable.Short answer
flutter gen-l10n reads the template ARB file named in l10n.yaml before it generates anything, and stops when it cannot. The file may lack read permission, may not exist under that name, may sit outside the arb-dir folder, or its keys may not be valid Dart method names. The error line names which one it is.
Fix it fast
1Find out which cause you have
Run the generator on its own, so the error is the last thing printed, then compare it with l10n.yaml and the folder on disk.
flutter gen-l10n cat l10n.yaml ls -l lib/l10n2Match what you see, then jump to its fix
- 1
The 'template-arb-file', ..., is not readable. Please ensure that the user has read permissions.The ARB file or its folder lacks read permissionFix - 2
The 'template-arb-file', ..., does not exist.l10n.yaml names a template file that is not thereFix - 3
The 'arb-dir' directory, '...', does not exist. Make sure that the correct path was provided.arb-dir points at a folder that does not existFix - 4
Invalid ARB resource name "..." in app_en.arb.A message key is not a valid Dart method nameFix
- 1
What does the error look like?
The 'template-arb-file', app_en.arb, is not readable.The 'template-arb-file', app_en.arb, does not exist.The 'arb-dir' directory, 'lib/l10n', does not exist.The 'arb-dir' directory, 'lib/l10n', doesn't allow reading and writing.Invalid ARB resource name
Cause 1 of 4
The ARB file or its folder lacks read permission
1Check
The tool inspects the file's permission bits before reading it. List the mode of the template file and of the folder that holds it, and compare them with the user you run Flutter as.
ls -l lib/l10n2Fix
Give your user read access to the file, and read and write access to the arb-dir folder, which the tool also checks.
chmod u+r lib/l10n/app_en.arb
chmod u+rwx lib/l10n3Verify
Run the generator again; it should finish without an error and write app_localizations.dart.
flutter gen-l10nConfirmed by raw.githubusercontent.com
Cause 2 of 4
l10n.yaml names a template file that is not there
1Check
The template defaults to app_en.arb when l10n.yaml does not set it. Compare the name in l10n.yaml, letter for letter, with the files in the arb-dir folder.
grep -n "template-arb-file" l10n.yaml
ls lib/l10n2Fix
Make the two agree: rename the file to the name l10n.yaml expects, or change template-arb-file to the name of the file you have.
# l10n.yaml
arb-dir: lib/l10n
template-arb-file: app_en.arb
output-localization-file: app_localizations.dart3Verify
Run the generator again.
flutter gen-l10nConfirmed by docs.flutter.dev
Cause 3 of 4
arb-dir points at a folder that does not exist
1Check
arb-dir is read relative to the project root and defaults to lib/l10n. A typo, or a folder that was moved while l10n.yaml stayed the same, makes the tool stop at once.
grep -n "arb-dir" l10n.yaml
ls -d lib/l10n2Fix
Point arb-dir at the folder that really holds the .arb files, or move the files to the folder l10n.yaml names.
# l10n.yaml
arb-dir: lib/l10n3Verify
Run the generator again.
flutter gen-l10nConfirmed by docs.flutter.dev
Cause 4 of 4
A message key is not a valid Dart method name
1Check
Each key in the template becomes a getter or method name in the generated class, so it has to be a valid Dart identifier. Look for keys with hyphens, spaces or a leading digit. The error names the key.
grep -n "my-bad-key" lib/l10n/app_en.arb2Fix
Rename the key in the template and in every translated file to a valid Dart name, for example camelCase, and update the code that calls it.
{
"welcomeTitle": "Welcome",
"@welcomeTitle": {
"description": "Title on the first screen"
}
}3Verify
Run the generator and then the analyzer so the renamed getter is picked up everywhere.
flutter gen-l10n
flutter analyzeConfirmed by raw.githubusercontent.com
How do I stop it coming back?
- Keep l10n.yaml, the arb-dir folder and the template file name in one commit, so a rename in one place cannot leave the others behind.
- Name message keys in camelCase from the start; a key becomes a method name.
- Run flutter gen-l10n in CI, so a broken l10n.yaml or a missing file fails the build early.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
- TaxiDexMy own multi-tenant taxi dispatch SaaS: API, dispatcher portal, driver and passenger apps, and the servers underneath.
- Qist BazaarA buy-now-pay-later marketplace built from a blank repo, now past 100K downloads on Google Play.
- SessionBirdAn omnichannel engagement suite in Flutter: campaigns, chatbot, tickets, analytics and live calling.
Related fixes
Mobile apps
Flutter cannot find the generated gen_l10n localizations file
Target of URI doesn't exist: 'package:flutter_gen/gen_l10n/gallery_localizations.dart'
Flutter 3.32 stopped creating the package:flutter_gen package.
3 causes, each with a fixMobile apps
AudioCache has no play method after updating audioplayers
The method 'play' isn't defined for the type 'AudioCache'.
Since audioplayers 1.0, AudioCache only turns asset files into local files and caches them.
2 causes, each with a fixMobile apps
Flutter Bloc throws that emit was called after the event handler completed
emit was called after an event handler completed normally.
Each on<Event> handler gets its own Emitter, and it stops working the moment the handler's returned Future completes.
2 causes, each with a fixMobile apps
analysis_options.yaml: the URI it includes can't be found
include_file_not_found
The analyzer reports include_file_not_found when the file named after include: in analysis_options.yaml does not resolve.
2 causes, each with a fixMobile apps
Dart error: the body might complete normally and return null for a non-nullable type
body_might_complete_normally
Dart found a path through your function or callback that reaches the closing brace without a return.
3 causes, each with a fixMobile apps
Dart throws ConcurrentModificationError while looping over a list
ConcurrentModificationError
Dart throws this when a collection changes size while something iterates it.
2 causes, each with a fix