abpframework/abp · error · CliUsageException

File {path} does not exist!

Error message

File {path} does not exist!

What it means

Thrown inside `GetAbpLocalizationInfoOrNull` when the supplied path does not exist on disk. Despite the generic message, this is a `CliUsageException` raised during `abp translate` after the path has already been used elsewhere, so reaching it means a path was passed that the filesystem cannot resolve.

Source

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

            "node_modules",
            "wwwroot",
            ".git",
            "bin",
            "obj"
        };

        var allCultureNames = CultureInfo.GetCultures(CultureTypes.AllCultures).Where(x => !x.Name.IsNullOrWhiteSpace()).Select(x => x.Name).ToList();
        return Directory.GetFiles(path, "*.json", SearchOption.AllDirectories)
            .Where(file => excludeDirectory.All(x => file.IndexOf(x, StringComparison.OrdinalIgnoreCase) == -1))
            .Where(file => allCultureNames.Any(x => Path.GetFileName(file).Equals($"{x}.json", StringComparison.OrdinalIgnoreCase)))
            .WhereIf(!cultureName.IsNullOrWhiteSpace(), jsonFile => Path.GetFileName(jsonFile).Equals($"{cultureName}.json", StringComparison.OrdinalIgnoreCase));
    }

    private AbpLocalizationInfo GetAbpLocalizationInfoOrNull(string path)
    {
        if (!File.Exists(path))
        {
            throw new CliUsageException(
                $"File {path} does not exist!" +
                Environment.NewLine + Environment.NewLine +
                GetUsageInfo()
            );
        }

        var json = File.ReadAllText(path);
        JObject jObject;
        try
        {
            jObject = JObject.Parse(json);
        }
        catch (Exception)
        {
            return null;
        }

        var culture = jObject.GetValue("culture") ?? jObject.GetValue("Culture");

View on GitHub (pinned to 7ed43b1931)

Solutions

  1. Check the exact path in the message and confirm it exists with `ls`/File Explorer, paying attention to case on Linux/macOS.
  2. Re-run `abp translate` from the solution root so `ResourcePath` resolves correctly.
  3. Ensure no antivirus or build process is deleting the culture JSON during the run.
Defensive patterns

Strategy: validation

Validate before calling

string path = Path.Combine(resourcePath, culture + ".json");
if (!File.Exists(path))
    throw new FileNotFoundException($"Localization file not found: {path}");
// case-sensitive check on Linux
var onDisk = Directory.GetFiles(resourcePath, "*.json")
    .FirstOrDefault(f => string.Equals(Path.GetFileName(f), culture + ".json", StringComparison.Ordinal));
if (onDisk == null)
    throw new InvalidOperationException($"Casing mismatch for culture file: {path}");

Try / catch

try { info = GetAbpLocalizationInfoOrNull(path); }
catch (CliUsageException ex) when (ex.Message.StartsWith("File "))
{
    logger.LogWarning("Localization file missing; will skip resource: {Path}", path);
    continue;
}

Prevention

When it happens

Trigger: Calling `GetAbpLocalizationInfoOrNull(path)` (internally during translate) with a path whose parent directory or filename is misspelled, or where the file was deleted between the `File.Exists` check and the call.

Common situations: Mismatched culture name casing on case-sensitive filesystems (Linux); relative path resolved against an unexpected working directory; file removed by another process mid-command.

Related errors


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