{"record":{"id":"a1251566a33ce118","repo":"abpframework/abp","slug":"deepl-auth-key-is-missing","errorCode":null,"errorMessage":"DeepL auth key is missing!","messagePattern":"DeepL auth key is missing!","errorType":"exception","errorClass":"CliUsageException","httpStatus":null,"severity":"error","filePath":"framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/TranslateCommand.cs","lineNumber":58,"sourceCode":"        {\n            var inputFile = Path.Combine(currentDirectory, commandLineArgs.Options.GetOrNull(Options.File.Short, Options.File.Long) ?? \"abp-translation.json\");\n            await ApplyAbpTranslateInfoAsync(currentDirectory, inputFile);\n            return;\n        }\n\n        var targetCulture = commandLineArgs.Options.GetOrNull(Options.Culture.Short, Options.Culture.Long);\n        if (targetCulture == null)\n        {\n            throw new CliUsageException(\"Target culture is missing!\" + Environment.NewLine + Environment.NewLine + GetUsageInfo());\n        }\n\n        // Translate online\n        if (commandLineArgs.Options.ContainsKey(Options.Online.Long))\n        {\n            var authKey = commandLineArgs.Options.GetOrNull(Options.DeepLAuthKey.Short, Options.DeepLAuthKey.Short);\n            if (authKey == null)\n            {\n                throw new CliUsageException(\"DeepL auth key is missing!\" + Environment.NewLine + Environment.NewLine + GetUsageInfo());\n            }\n            await TranslateAbpTranslateInfoAsync(currentDirectory, targetCulture, referenceCulture, allValues, authKey);\n            return;\n        }\n\n        // Generate abp-translation.json file\n        var outputFile = Path.Combine(currentDirectory, commandLineArgs.Options.GetOrNull(Options.Output.Short, Options.Output.Long) ?? \"abp-translation.json\");\n        await GenerateAbpTranslateInfoAsync(currentDirectory, targetCulture, referenceCulture, allValues, outputFile);\n    }\n\n    private Task GenerateAbpTranslateInfoAsync(string currentDirectory, string targetCulture, string referenceCulture, bool allValues, string outputFile)\n    {\n        Logger.LogInformation(\"Abp translate...\");\n        Logger.LogInformation(\"Target culture: \" + targetCulture);\n        Logger.LogInformation(\"Reference culture: \" + referenceCulture);\n        Logger.LogInformation(\"Output file: \" + outputFile);\n        if (allValues)\n        {","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/abpframework/abp/blob/7ed43b1931b9df46a50c0c59148a18645641d0df/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/TranslateCommand.cs#L40-L76","documentation":"Thrown by TranslateCommand.ExecuteAsync when --online is set but --deepl-auth-key is not provided. DeepL API requires an authentication key for programmatic translation access. Note: there is a code bug on line 55 where GetOrNull(Options.DeepLAuthKey.Short, Options.DeepLAuthKey.Short) passes the same key twice instead of Short and Long, but since DeepLAuthKey only defines Short = 'deepl-auth-key' (no Long constant), it still works correctly by accident.","triggerScenarios":"Running 'abp translate --culture <c> --online' without the --deepl-auth-key flag. For example: 'abp translate -c zh-Hans --online' without the key.","commonSituations":"Developer doesn't have a DeepL API account, forgets to include the key, or doesn't realize --online requires it. DeepL offers a free tier with 500,000 characters/month.","solutions":["Sign up for a DeepL API account at deepl.com/pro (free tier available)","Add --deepl-auth-key <your-deepl-api-key> to the command","If you don't want online translation, remove --online to generate the translation file locally for manual translation","Store the key in an environment variable to avoid pasting it each time"],"exampleFix":"// before\nabp translate -c zh-Hans --online\n\n// after\nabp translate -c zh-Hans --online --deepl-auth-key YOUR_DEEPL_KEY","handlingStrategy":"validation","validationCode":"// Validate DeepL auth key when using --online\nvar isOnline = commandLineArgs.Options.ContainsKey(\"online\");\nvar hasAuthKey = commandLineArgs.Options.ContainsKey(\"deepl-auth-key\");\n\nif (isOnline && !hasAuthKey)\n{\n    Console.Error.WriteLine(\"Error: --deepl-auth-key is required when using --online.\");\n    return;\n}","typeGuard":null,"tryCatchPattern":"try\n{\n    await translateCommand.ExecuteAsync(commandLineArgs);\n}\ncatch (CliUsageException ex) when (ex.Message.Contains(\"DeepL auth key is missing\"))\n{\n    Console.Error.WriteLine(\"Missing --deepl-auth-key. Get a free key at deepl.com/pro\");\n}","preventionTips":["Register for a DeepL API key at deepl.com before using --online mode","Store the key in an environment variable: export DEEPL_KEY=xxx, then pass --deepl-auth-key $DEEPL_KEY","If you don't have a DeepL key, use offline mode (omit --online) for manual translation"],"tags":["translate","deepl","authentication","cli","missing-argument"],"backgroundTag":null,"analyzedSha":"7ed43b1931b9df46a50c0c59148a18645641d0df","analyzedAt":"2026-08-13T16:26:11.351Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}