abpframework/abp · error · CliUsageException

{translateJsonPath} file does not exist..

Error message

{translateJsonPath} file does not exist..

What it means

Thrown by ApplyAbpTranslateInfoAsync when the translation JSON file (default: abp-translation.json, or a custom file specified with -f/--file) does not exist on disk. The --apply mode reads this file and applies translations to the target culture files. The file must first be generated using 'abp translate -c <culture>' (without --apply). Note: double-period typo in message ('exist..').

Source

Thrown at framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/TranslateCommand.cs:301

            throw new CliUsageException(
                $"DeepL does not support {abpCulture} culture." +
                Environment.NewLine + Environment.NewLine +
                GetUsageInfo()
            );
        }

        return Task.FromResult(deeplCulture);
    }

    private Task ApplyAbpTranslateInfoAsync(string directory, string filename)
    {
        Logger.LogInformation("Abp translate apply...");
        Logger.LogInformation("Input file: " + filename);

        var translateJsonPath = Path.Combine(directory, filename);
        if (!File.Exists(translateJsonPath))
        {
            throw new CliUsageException(
                $"{translateJsonPath} file does not exist.." +
                Environment.NewLine + Environment.NewLine +
                GetUsageInfo()
            );
        }

        var translateInfo = GetAbpTranslateInfo(translateJsonPath);
        foreach (var resource in translateInfo.Resources)
        {
            var targetFile = Path.Combine(resource.ResourcePath, translateInfo.TargetCulture + ".json");
            var targetLocalizationInfo = File.Exists(targetFile)
                ? GetAbpLocalizationInfoOrNull(targetFile)
                : new AbpLocalizationInfo()
                {
                    Culture = translateInfo.TargetCulture,
                    Texts = new List<NameValue>()
                };

View on GitHub (pinned to 7ed43b1931)

Solutions

  1. First generate the translation file: 'abp translate -c <culture>' (without --apply)
  2. Then apply it: 'abp translate --apply'
  3. If using a custom file name, pass it: 'abp translate --apply -f my-translation.json'
  4. Ensure you're in the same working directory where the file was generated

Example fix

// before (no translation file exists yet)
abp translate --apply

// after (generate first, then apply)
abp translate -c zh-Hans
abp translate --apply
Defensive patterns

Strategy: validation

Validate before calling

// Pre-check that translation file exists before applying
var translateFile = Path.Combine(currentDirectory, 
    commandLineArgs.Options.GetOrNull("f", "file") ?? "abp-translation.json");
if (!File.Exists(translateFile))
{
    Console.Error.WriteLine($"Error: Translation file not found: {translateFile}");
    Console.Error.WriteLine("Generate it first with: abp translate -c <culture>");
    return;
}

Try / catch

try
{
    await ApplyAbpTranslateInfoAsync(directory, filename);
}
catch (CliUsageException ex) when (ex.Message.Contains("file does not exist"))
{
    Console.Error.WriteLine($"Translation file missing. Run 'abp translate -c <culture>' first to generate it.");
}

Prevention

When it happens

Trigger: Running 'abp translate --apply' when abp-translation.json doesn't exist in the current directory. Or running 'abp translate --apply -f custom.json' when custom.json doesn't exist.

Common situations: Running --apply before generating the translation file, file was deleted, wrong working directory, custom file name specified incorrectly, translation was generated in a different directory.

Related errors


AI-assisted analysis of abpframework/abp@7ed43b1931 (2026-08-13). Data as JSON: /api/errors/b340bdef1378d32b. Report an issue: GitHub.