Signature
Return Value
Returns a special userdata object that acts like a table but provides enhanced error checking when you assign configuration options.Description
The config builder may look like a regular Lua table, but it is a special userdata type that:- Validates configuration options - Warns or errors when you try to set invalid options
- Provides stack traces - Shows exactly where in your config file the error occurred
- Supports strict mode - Can promote warnings to errors to catch mistakes early
Basic Usage
Enhanced Error Reporting
When you make a typo or use an invalid configuration option, the config builder provides detailed context:Without config_builder
With config_builder
Strict Mode
You can promote warnings to errors using strict mode. This will cause WezTerm to show a configuration error window and use the default config until you resolve the error.Enable or disable strict mode for the config builder.
Example with Strict Mode
Benefits
Catches typos and invalid options immediately instead of silently ignoring them
Shows exactly where the problem is in your config file, even in helper functions
Optional error promotion prevents WezTerm from starting with invalid configuration
Works with existing configs - use conditional check for older versions
Backward Compatibility
For configs that need to work with both current and older WezTerm versions:When to Use
It’s recommended to use
wezterm.config_builder() in all new configurations. It helps catch configuration errors early and makes debugging much easier.Related Functions
- wezterm.config_file - Path to your config file
- wezterm.config_dir - Directory containing your config
- wezterm.reload_configuration() - Reload the configuration
Source Reference
Implementation:config/src/lua.rs:283-298