{"record":{"id":"94f1f9ddc5d3fb0e","repo":"microsoft/aspire","slug":"no-code-generator-found-for-language-language-available","errorCode":null,"errorMessage":"No code generator found for language: {language}. Available languages: {string.Join(\", \", available)}. (When none discovered: No code generator found for language: {language}. No code generators were discovered in any loaded assembly. This usually indicates a binary mismatch between the bundled apphost server and the integration assemblies on disk; check the apphost server log for 'LoaderExceptions' Warnings.)","messagePattern":"No code generator found for language: (.+?)\\. Available languages: (.+?)\\. \\(When none discovered: No code generator found for language: (.+?)\\. No code generators were discovered in any loaded assembly\\. This usually indicates a binary mismatch between the bundled apphost server and the integration assemblies on disk; check the apphost server log for 'LoaderExceptions' Warnings\\.\\)","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Aspire.Hosting.RemoteHost/CodeGeneration/CodeGenerationService.cs","lineNumber":248,"sourceCode":"    /// Generates SDK code for the specified language.\n    /// </summary>\n    /// <param name=\"language\">The target language (e.g., \"TypeScript\", \"Python\").</param>\n    /// <param name=\"assemblyName\">The exporting assembly to scope the generated SDK to, or null to use the full ATS context.</param>\n    /// <returns>A dictionary of file paths to file contents.</returns>\n    [JsonRpcMethod(GenerateCodeMethodName)]\n    public Dictionary<string, string> GenerateCode(string language, string? assemblyName = null)\n    {\n        using var rpcActivity = _profilingTelemetry.StartJsonRpcServerCall(GenerateCodeMethodName);\n        using var activity = _profilingTelemetry.StartCodeGenerationGenerate(language);\n        try\n        {\n            _authenticationState.ThrowIfNotAuthenticated();\n            _logger.LogDebug(\">> generateCode({Language})\", language);\n            var sw = System.Diagnostics.Stopwatch.StartNew();\n            var generator = _resolver.GetCodeGenerator(language);\n            if (generator == null)\n            {\n                throw new ArgumentException(BuildNoCodeGeneratorMessage(language));\n            }\n\n            var context = _atsContextFactory.GetContext();\n            if (!string.IsNullOrWhiteSpace(assemblyName))\n            {\n                // Scoped source generation must not use the API-export filter: its synthetic\n                // supporting capabilities are projection-only metadata and would otherwise become\n                // executable members in the generated SDK.\n                context = AtsContextFilter.FilterByExportingAssembliesWithReferences(context, [assemblyName]);\n            }\n\n            var files = generator.GenerateDistributedApplication(context);\n            activity.SetFileCount(files.Count);\n\n            _logger.LogDebug(\"<< generateCode({Language}) completed in {ElapsedMs}ms, generated {FileCount} files\", language, sw.ElapsedMilliseconds, files.Count);\n            return files;\n        }\n        catch (Exception ex)","sourceCodeStart":230,"sourceCodeEnd":266,"githubUrl":"https://github.com/microsoft/aspire/blob/25830f84bd145686607ad00c057b3f84e2e51d43/src/Aspire.Hosting.RemoteHost/CodeGeneration/CodeGenerationService.cs#L230-L266","documentation":"CodeGenerationService.GenerateCode resolves a code generator for the requested language through an ICodeGeneratorResolver over all loaded assemblies. If none is registered (generator == null) it throws ArgumentException with a message listing the languages that WERE discovered, or — when none were discovered at all — a hint that this usually indicates a binary mismatch between the bundled apphost server and the integration assemblies on disk (check the apphost server log for 'LoaderExceptions' Warnings).","triggerScenarios":"Invoking the generateCode ATS capability with a language string (e.g. 'typescript', 'python') for which no discovered code generator exists, or when the scan found no ICodeGenerator implementations in any loaded assembly because integration assemblies failed to load.","commonSituations":"Typo/unsupported language name; version-skew where the apphost server bundle predates the generator assemblies on disk; integration DLLs blocked or failing to load (loader exceptions, missing dependencies), so no generators register.","solutions":["Use one of the languages listed in the 'Available languages' portion of the message.","Check the apphost server log for 'LoaderExceptions' Warnings and fix assembly load failures.","Align the bundled apphost server version with the Aspire integration assemblies on disk (update SDK/packages together, clean bin/obj).","Ensure your project references a package that ships the generator for the target language."],"exampleFix":"// before: unsupported language id\nawait client.CallCapabilityAsync(\"generateCode\", new { language = \"ts\" });\n// after\nawait client.CallCapabilityAsync(\"generateCode\", new { language = \"typescript\" });","handlingStrategy":"validation","validationCode":"// discover supported languages before calling generateCode\nvar languages = client.GetAvailableLanguages(); // from resolver/discovery API\nif (!languages.Contains(language))\n    throw new ArgumentException($\"Language '{language}' unavailable. Supported: {string.Join(\", \", languages)}\");","typeGuard":"static bool IsSupportedLanguage(string language, IEnumerable<string> available) =>\n    available.Contains(language, StringComparer.OrdinalIgnoreCase);","tryCatchPattern":"try { await service.GenerateCode(language); }\ncatch (ArgumentException ex) when (ex.Message.Contains(\"No code generator found\"))\n{ log.LogError(ex, \"Unsupported language or generator assemblies failed to load\"); throw; }","preventionTips":["Use exactly the language strings reported by the generator resolver.","After SDK updates, check apphost server logs for LoaderExceptions Warnings.","Reference the integration package that ships the generator for your language."],"tags":["code-generation","ats","language","assembly-loading"],"backgroundTag":"unsupported-enum-value","analyzedSha":"25830f84bd145686607ad00c057b3f84e2e51d43","analyzedAt":"2026-09-16T11:10:06.193Z","contentChangedAt":"2026-09-16T11:10:06.193Z","schemaVersion":2},"datasetVersion":"2026-09-21T04:17:39.646Z"}