abpframework/abp · error · CliUsageException
{e.Message}
Error message
{e.Message} What it means
Thrown by `GetAbpTranslateInfo` when `JsonConvert.DeserializeObject<AbpTranslateInfo>` throws while parsing `abp-translation.json`. The original exception message is wrapped and surfaced as a `CliUsageException` with usage help, so the text you see is the underlying JSON/deserialization error.
Source
Thrown at framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/TranslateCommand.cs:472
private AbpTranslateInfo GetAbpTranslateInfo(string path)
{
if (!File.Exists(path))
{
throw new CliUsageException(
$"File {path} does not exist!" +
Environment.NewLine + Environment.NewLine +
GetUsageInfo()
);
}
AbpTranslateInfo translateInfo;
try
{
translateInfo = JsonConvert.DeserializeObject<AbpTranslateInfo>(File.ReadAllText(path));
}
catch (Exception e)
{
throw new CliUsageException(
e.Message +
Environment.NewLine + Environment.NewLine +
GetUsageInfo()
);
}
return translateInfo;
}
private Task VerifyJsonAsync(string currentDirectory)
{
var jsonFiles = GetCultureJsonFiles(currentDirectory);
var hasInvalidJsonFile = false;
foreach (var jsonFile in jsonFiles)
{
try
{
var jsonString = File.ReadAllText(jsonFile);View on GitHub (pinned to 7ed43b1931)
Solutions
- Paste the contents of `abp-translation.json` into a JSON validator to find the exact parse location.
- Regenerate `abp-translation.json` with `abp translate` and re-apply your changes incrementally.
- Ensure the file is saved as UTF-8 without BOM and remove any merge-conflict markers.
Example fix
// before (invalid): { "TargetCulture": "tr", "ReferenceCulture": "en",, }
// after: { "TargetCulture": "tr", "ReferenceCulture": "en", "Resources": [] } Defensive patterns
Strategy: try-catch
Validate before calling
static bool IsValidTranslateJson(string path)
{
try
{
Newtonsoft.Json.Linq.JObject.Parse(File.ReadAllText(path));
Newtonsoft.Json.JsonConvert.DeserializeObject<AbpTranslateInfo>(File.ReadAllText(path));
return true;
}
catch { return false; }
}
if (!IsValidTranslateJson("abp-translation.json"))
Console.Error.WriteLine("abp-translation.json is invalid; regenerate it."); Try / catch
AbpTranslateInfo info;
try { info = GetAbpTranslateInfo(path); }
catch (CliUsageException ex)
{
logger.LogError("Failed to parse abp-translation.json: {Underlying}", ex.Message);
throw;
} Prevention
- Validate `abp-translation.json` with a JSON linter before committing.
- Regenerate the file via `abp translate` instead of hand-editing.
- Save localization files as UTF-8 without BOM.
When it happens
Trigger: `abp-translation.json` is syntactically invalid JSON, contains a type that does not map to `AbpTranslateInfo` (e.g. wrong property names/types), or has trailing commas / encoding issues.
Common situations: Hand-editing `abp-translation.json` and introducing a syntax error; merge conflict markers left in the file; file saved with a BOM or non-UTF8 encoding that breaks the parser.
Related errors
- Target culture is missing!
- Failed to get localization information from {targetFile} fil
- Failed to get localization information from {referenceFile}
- File {path} does not exist!
- DeepL auth key is missing!
AI-assisted analysis of abpframework/abp@7ed43b1931 (2026-08-13).
Data as JSON: /api/errors/89ea41d4e89f32b2.
Report an issue: GitHub.