microsoft/aspire · error · ArgumentException
No code generator found for language
Error message
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.) What it means
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).
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.
Example fix
// before: unsupported language id
await client.CallCapabilityAsync("generateCode", new { language = "ts" });
// after
await client.CallCapabilityAsync("generateCode", new { language = "typescript" }); Defensive patterns
Strategy: validation
Validate before calling
// discover supported languages before calling generateCode
var languages = client.GetAvailableLanguages(); // from resolver/discovery API
if (!languages.Contains(language))
throw new ArgumentException($"Language '{language}' unavailable. Supported: {string.Join(", ", languages)}"); Type guard
static bool IsSupportedLanguage(string language, IEnumerable<string> available) =>
available.Contains(language, StringComparer.OrdinalIgnoreCase); Try / catch
try { await service.GenerateCode(language); }
catch (ArgumentException ex) when (ex.Message.Contains("No code generator found"))
{ log.LogError(ex, "Unsupported language or generator assemblies failed to load"); throw; } Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- aspire: returned unexpected type %T
- no input with name ' ' was found
- Package ' ' version ' ' was mapped from restored asset…
- -32602
- argument ' ' passed to capability ' ' contains a circular…
AI-assisted analysis of microsoft/aspire@25830f84bd (2026-09-16).
Data as JSON: /api/errors/94f1f9ddc5d3fb0e.
Report an issue: GitHub.
Appendix: source
Thrown at src/Aspire.Hosting.RemoteHost/CodeGeneration/CodeGenerationService.cs:248
/// Generates SDK code for the specified language.
/// </summary>
/// <param name="language">The target language (e.g., "TypeScript", "Python").</param>
/// <param name="assemblyName">The exporting assembly to scope the generated SDK to, or null to use the full ATS context.</param>
/// <returns>A dictionary of file paths to file contents.</returns>
[JsonRpcMethod(GenerateCodeMethodName)]
public Dictionary<string, string> GenerateCode(string language, string? assemblyName = null)
{
using var rpcActivity = _profilingTelemetry.StartJsonRpcServerCall(GenerateCodeMethodName);
using var activity = _profilingTelemetry.StartCodeGenerationGenerate(language);
try
{
_authenticationState.ThrowIfNotAuthenticated();
_logger.LogDebug(">> generateCode({Language})", language);
var sw = System.Diagnostics.Stopwatch.StartNew();
var generator = _resolver.GetCodeGenerator(language);
if (generator == null)
{
throw new ArgumentException(BuildNoCodeGeneratorMessage(language));
}
var context = _atsContextFactory.GetContext();
if (!string.IsNullOrWhiteSpace(assemblyName))
{
// Scoped source generation must not use the API-export filter: its synthetic
// supporting capabilities are projection-only metadata and would otherwise become
// executable members in the generated SDK.
context = AtsContextFilter.FilterByExportingAssembliesWithReferences(context, [assemblyName]);
}
var files = generator.GenerateDistributedApplication(context);
activity.SetFileCount(files.Count);
_logger.LogDebug("<< generateCode({Language}) completed in {ElapsedMs}ms, generated {FileCount} files", language, sw.ElapsedMilliseconds, files.Count);
return files;
}
catch (Exception ex)View on GitHub (pinned to 25830f84bd)