{"record":{"id":"50c9cceea8f3bbc2","repo":"microsoft/aspire","slug":"unknown-language-explicitlanguageid","errorCode":null,"errorMessage":"Unknown language: '{explicitLanguageId}'","messagePattern":"Unknown language: '(.+?)'","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Aspire.Cli/Projects/LanguageService.cs","lineNumber":129,"sourceCode":"        var selection = await GetOrPromptForProjectSelectionAsync(explicitLanguageId, saveLanguageSelection, cancellationToken);\n\n        return selection.Project;\n    }\n\n    /// <inheritdoc />\n    public async Task<AppHostProjectSelection> GetOrPromptForProjectSelectionAsync(\n        string? explicitLanguageId = null,\n        bool saveLanguageSelection = true,\n        CancellationToken cancellationToken = default)\n    {\n        // If explicitly specified, use that\n        if (!string.IsNullOrWhiteSpace(explicitLanguageId))\n        {\n            var language = _languageDiscovery.GetLanguageById(explicitLanguageId);\n            if (language is null)\n            {\n                _interactionService.DisplayError($\"Unknown language: '{explicitLanguageId}'\");\n                throw new ArgumentException($\"Unknown language: '{explicitLanguageId}'\", nameof(explicitLanguageId));\n            }\n\n            return new AppHostProjectSelection(_projectFactory.GetProject(language), ShouldPersistSelection: false);\n        }\n\n        // Check if configured\n        var configuredProject = await GetConfiguredProjectAsync(cancellationToken);\n        if (configuredProject is not null)\n        {\n            return new AppHostProjectSelection(configuredProject, ShouldPersistSelection: false);\n        }\n\n        // Prompt for selection\n        var (selectedProject, selectedLanguage) = await PromptForProjectWithLanguageAsync(cancellationToken);\n\n        // Save the language ID\n        if (saveLanguageSelection)\n        {","sourceCodeStart":111,"sourceCodeEnd":147,"githubUrl":"https://github.com/microsoft/aspire/blob/25830f84bd145686607ad00c057b3f84e2e51d43/src/Aspire.Cli/Projects/LanguageService.cs#L111-L147","documentation":"When an explicit language id is supplied to project selection, LanguageService looks it up via language discovery; unknown ids are reported to the user and surfaced as ArgumentException naming the parameter. This prevents silently creating a project for a mis-typed language.","triggerScenarios":"Calling GetOrPromptForProjectSelectionAsync with a languageId (e.g. from a CLI flag or saved setting) that GetLanguageById does not recognize.","commonSituations":"Typing 'csharp' vs supported ids like 'dotnet'/'python'/'java', an outdated saved selection in aspire.config after a language was renamed or removed, or scripting the CLI with a wrong value.","solutions":["Run the command without the language flag to see the list of supported language ids and pick interactively","Correct the language id to one of the supported values reported by language discovery","Clear or update any persisted selection in aspire.config.json that references the removed language"],"exampleFix":"// before\naspire new --language csharp   # unknown id\n// after\naspire new --language dotnet   # supported id","handlingStrategy":"validation","validationCode":"var supported = languageDiscovery.GetLanguages().Select(l => l.Id).ToHashSet(StringComparer.OrdinalIgnoreCase);\nif (!string.IsNullOrWhiteSpace(langId) && !supported.Contains(langId))\n    throw new ArgumentException($\"Unknown language: '{langId}'. Supported: {string.Join(\", \", supported)}\");","typeGuard":null,"tryCatchPattern":"try { var sel = await svc.GetOrPromptForProjectSelectionAsync(langId, ...); }\ncatch (ArgumentException ex) when (ex.ParamName == nameof(explicitLanguageId))\n{\n    // fall back to interactive selection\n    sel = await svc.GetOrPromptForProjectSelectionAsync(null, ...);\n}","preventionTips":["Validate the language flag against discovery output before passing it","Refresh persisted selections in aspire.config.json after CLI upgrades","Prefer interactive selection in scripts unless the id is verified"],"tags":["cli","language","invalid-argument"],"backgroundTag":"invalid-enum-value","analyzedSha":"25830f84bd145686607ad00c057b3f84e2e51d43","analyzedAt":"2026-09-16T11:10:06.193Z","contentChangedAt":"2026-09-16T11:10:06.193Z","schemaVersion":2},"datasetVersion":"2026-09-21T09:17:21.228Z"}