Skip to main content
Returns a config builder object that can be used to define your configuration with improved error checking and validation.

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

Warning output:

With config_builder

Warning output with stack trace:

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.
function
Enable or disable strict mode for the config builder.

Example with Strict Mode

Benefits

feature
Catches typos and invalid options immediately instead of silently ignoring them
feature
Shows exactly where the problem is in your config file, even in helper functions
feature
Optional error promotion prevents WezTerm from starting with invalid configuration
feature
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.

Source Reference

Implementation: config/src/lua.rs:283-298