{"record":{"id":"d6108ef365210195","repo":"tui-cs/Terminal.Gui","slug":"driver-drivername-is-not-registered-in-driverr","errorCode":null,"errorMessage":"Driver '{driverName}' is not registered in DriverRegistry.","messagePattern":"Driver '(.+?)' is not registered in DriverRegistry\\.","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"critical","filePath":"Terminal.Gui/App/ApplicationImpl.Driver.cs","lineNumber":57,"sourceCode":"            }\n            else if (_componentFactory is IComponentFactory<ConsoleKeyInfo> netFactory)\n            {\n                Coordinator = CreateSubcomponents (() => netFactory);\n            }\n            else if (_componentFactory is IComponentFactory<char> unixFactory)\n            {\n                Coordinator = CreateSubcomponents (() => unixFactory);\n            }\n            else\n            {\n                throw new InvalidOperationException ($\"Unknown component factory type: {_componentFactory.GetType ().Name}\");\n            }\n        }\n        else\n        {\n            if (!string.IsNullOrEmpty (driverName) && !DriverRegistry.TryGetDriver (driverName, out _))\n            {\n                throw new ArgumentException ($\"Driver '{driverName}' is not registered in DriverRegistry.\");\n            }\n\n            // Determine which driver to use\n            if (!string.IsNullOrEmpty (driverName) && DriverRegistry.TryGetDriver (driverName, out DriverRegistry.DriverDescriptor? descriptor))\n            {\n                // Use explicitly specified driver name\n                _driverName = descriptor!.Name;\n                Trace.Lifecycle (MainThreadId?.ToString (), \"Init\", $\"Using driver specified by parameter: {descriptor.Name} ({descriptor.DisplayName})\");\n            }\n            else if (!string.IsNullOrEmpty (ForceDriver) && DriverRegistry.TryGetDriver (ForceDriver, out descriptor))\n            {\n                // Use ForceDriver configuration property\n                _driverName = descriptor!.Name;\n\n                Trace.Lifecycle (MainThreadId?.ToString (),\n                                 \"Init\",\n                                 $\"Using driver from ForceDriver configuration: {descriptor.Name} ({descriptor.DisplayName})\");\n            }","sourceCodeStart":39,"sourceCodeEnd":75,"githubUrl":"https://github.com/tui-cs/Terminal.Gui/blob/2e47b11478db083499917f2ad27c34d30efb0df1/Terminal.Gui/App/ApplicationImpl.Driver.cs#L39-L75","documentation":"Thrown by ApplicationImpl.CreateDriver when a driverName is passed (or set via ForceDriver) that does not exist in DriverRegistry. The registry only knows the built-in names: \"Windows\", \"DotNet\", and \"ANSI\". Any other string fails DriverRegistry.TryGetDriver and triggers this ArgumentException before any driver is constructed.","triggerScenarios":"Calling app.Init(\"MyCustomDriver\") or Application.Create().Init(\"foo\") with an unregistered name; setting ForceDriver to an unknown value (e.g. via config or the GUIRESOURCES env var); misspelling a driver name like \"Win32\" instead of \"Windows\" or \"dotnet\" casing issues.","commonSituations":"Copy-pasting a driver name from outdated v1 documentation or forum posts; migrating from v1 where driver names differed; setting the FORCE_DRIVER environment variable / ForceDriver property to an experimental value; typos in configuration JSON.","solutions":["Use one of the valid built-in driver names: \"Windows\", \"DotNet\", or \"ANSI\".","Pass null/empty driverName to let DriverRegistry auto-select the platform default driver (GetDefaultDriver).","If you need a custom driver, register it in DriverRegistry before calling Init via its registration API, or supply an IComponentFactory to the ApplicationImpl before Init.","Check for typos and casing: names are matched exactly by DriverRegistry.TryGetDriver."],"exampleFix":"// before\napp.Init (\"Win32\");\n\n// after\napp.Init (\"Windows\");\n// or let it auto-detect:\napp.Init ();","handlingStrategy":"validation","validationCode":"string driver = \"Windows\";\nif (DriverRegistry.TryGetDriver (driver, out _))\n{\n    app.Init (driver);\n}\nelse\n{\n    app.Init (); // fall back to platform default\n}","typeGuard":"static bool IsValidDriverName (string name) =>\n    DriverRegistry.TryGetDriver (name, out _);","tryCatchPattern":null,"preventionTips":["Use only the documented names: Windows, DotNet, ANSI.","Pass null/empty to let the platform default be selected automatically.","Register any custom driver with DriverRegistry before referencing its name in Init."],"tags":["driver","initialization","config","platform"],"backgroundTag":null,"analyzedSha":"2e47b11478db083499917f2ad27c34d30efb0df1","analyzedAt":"2026-08-13T19:20:08.826Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}