{"record":{"id":"69fba5c740af336d","repo":"spectreconsole/spectre.console","slug":"cannot-show-selection-prompt-since-the-current-ter-69fba5","errorCode":null,"errorMessage":"Cannot show selection prompt since the current terminal does not support ANSI escape sequences.","messagePattern":"Cannot show selection prompt since the current terminal does not support ANSI escape sequences\\.","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"src/Spectre.Console/Prompts/List/ListPrompt.cs","lineNumber":36,"sourceCode":"        SelectionMode selectionMode,\n        bool skipUnselectableItems,\n        bool searchEnabled,\n        int requestedPageSize,\n        bool wrapAround,\n        CancellationToken cancellationToken = default)\n    {\n        ArgumentNullException.ThrowIfNull(tree);\n\n        if (!_console.Profile.Capabilities.Interactive)\n        {\n            throw new NotSupportedException(\n                \"Cannot show selection prompt since the current \" +\n                \"terminal isn't interactive.\");\n        }\n\n        if (!_console.Profile.Capabilities.Ansi)\n        {\n            throw new NotSupportedException(\n                \"Cannot show selection prompt since the current \" +\n                \"terminal does not support ANSI escape sequences.\");\n        }\n\n        var nodes = tree.Traverse().ToList();\n        if (nodes.Count == 0)\n        {\n            throw new InvalidOperationException(\"Cannot show an empty selection prompt. Please call the AddChoice() method to configure the prompt.\");\n        }\n\n        var state = new ListPromptState<T>(\n            nodes,\n            converter,\n            _strategy.CalculatePageSize(_console, nodes.Count, requestedPageSize),\n            wrapAround,\n            selectionMode,\n            skipUnselectableItems,\n            searchEnabled,","sourceCodeStart":18,"sourceCodeEnd":54,"githubUrl":"https://github.com/spectreconsole/spectre.console/blob/0acc92fada6c42f13984e79c2b5f3d993bdfb099/src/Spectre.Console/Prompts/List/ListPrompt.cs#L18-L54","documentation":"Thrown by ListPrompt<T>.Show(...) when the console profile's Capabilities.Ansi is false. Selection prompts render using ANSI escape sequences for cursor movement, color, and screen updates. A terminal without ANSI support (legacy Windows cmd without virtual terminal processing, dumb terminals, or a manually-created console with Ansi = false) cannot render the prompt UI. This is checked after the Interactive check.","triggerScenarios":"Calling SelectionPrompt or MultiSelectionPrompt on a console where ANSI is disabled — e.g., Windows CMD with VT processing off, or AnsiConsole.Create with Capabilities.Ansi = false, or environments where Spectre's detection fails to enable ANSI.","commonSituations":"Legacy Windows environments without virtual terminal support; custom AnsiConsole setup that explicitly disables ANSI; older Windows Terminal/Console Host on Windows 10 pre-1809; environments where TERM is set to 'dumb'; CI runners on Windows without ANSI enabled.","solutions":["Ensure ANSI is enabled: on Windows, enable virtual terminal processing or use Windows Terminal; on CI, set appropriate TERM.","When using AnsiConsole.Create, set Capabilities.Ansi = true if you know the target supports it.","Guard prompt calls: check AnsiConsole.Profile.Capabilities.Ansi before showing interactive prompts.","Provide a non-ANSI fallback (plain text menu, config file, command-line args) when ANSI is unavailable."],"exampleFix":"// before\nvar settings = new AnsiConsoleSettings\n{\n    Out = new AnsiConsoleOutput(Console.Out),\n};\nvar console = AnsiConsole.Create(settings);\nvar choice = console.Prompt(selectionPrompt);\n\n// after\nvar settings = new AnsiConsoleSettings\n{\n    Out = new AnsiConsoleOutput(Console.Out),\n};\nsettings.Capabilities.Ansi = true; // or detect/enforce\nvar console = AnsiConsole.Create(settings);\nvar choice = console.Prompt(selectionPrompt);","handlingStrategy":"validation","validationCode":"if (!AnsiConsole.Profile.Capabilities.Ansi)\n{\n    // Provide a non-ANSI fallback (plain text, config, args)\n    return defaultValue;\n}\nvar choice = AnsiConsole.Prompt(\n    new SelectionPrompt<string>()\n        .Title(\"Pick one\")\n        .AddChoices(options));","typeGuard":"static bool CanShowAnsiPrompt(IAnsiConsole console)\n    => console.Profile.Capabilities.Interactive\n       && console.Profile.Capabilities.Ansi;","tryCatchPattern":"try\n{\n    return AnsiConsole.Prompt(selectionPrompt);\n}\ncatch (NotSupportedException ex) when (ex.Message.Contains(\"ANSI\"))\n{\n    // Fall back to non-ANSI selection or default\n    return defaultValue;\n}","preventionTips":["Check Capabilities.Ansi before showing selection prompts.","On Windows, ensure virtual terminal processing is enabled or use Windows Terminal.","When using AnsiConsole.Create, explicitly set Capabilities.Ansi if the target supports it.","Provide a plain-text menu fallback for ANSI-incapable terminals."],"tags":["notsupportedexception","prompts","selection","ansi","terminal","windows"],"backgroundTag":null,"analyzedSha":"0acc92fada6c42f13984e79c2b5f3d993bdfb099","analyzedAt":"2026-08-13T18:27:21.983Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}