kovidgoyal/kitty · error

Empty include paths not allowed

Error message

Empty include paths not allowed

What it means

An include directive in a kitty config file had an empty path. The parser resolves each include path to an absolute path relative to the including file, and rejects empty strings.

Source

Thrown at tools/config/api.go:136

	if self.seen_includes[name] { // avoid include loops
		return nil
	}
	self.seen_includes[name] = true
	if self.AllIncludedFiles != nil && name != OverridesFileName {
		self.AllIncludedFiles.Add(name)
	}

	recurse := func(r io.Reader, nname, base_path_for_includes string) error {
		if depth > 32 {
			return fmt.Errorf("Too many nested include directives while processing config file: %s", name)
		}
		escanner := bufio.NewScanner(r)
		return self.parse(escanner, nname, base_path_for_includes, depth+1)
	}

	make_absolute := func(path string) (string, error) {
		if path == "" {
			return "", fmt.Errorf("Empty include paths not allowed")
		}
		if !filepath.IsAbs(path) {
			path = filepath.Join(base_path_for_includes, path)
		}
		return path, nil
	}

	lnum := 0
	next_line_num := 0
	next_line := ""
	var line string

	add_bad_line := func(err error) {
		self.bad_lines = append(self.bad_lines, ConfigLine{Src_file: name, Line: line, Line_number: lnum, Err: err})
	}

	for {
		if next_line != "" {

View on GitHub (pinned to 6d5d0c4406)

Solutions

  1. Open the file reported by the parser and find the include line with no path
  2. Add the intended path or delete the line entirely
  3. If using a template, ensure the placeholder was substituted before loading the config

Example fix

# before
include
# after
include themes/dark.conf
Defensive patterns

Strategy: validation

Validate before calling

line = strings.TrimSpace(line)
if line == "include" || strings.TrimSpace(strings.TrimPrefix(line, "include")) == "" {
    return fmt.Errorf("include directive with no path")
}

Prevention

When it happens

Trigger: A line like `include` or `include ` (only whitespace) in kitten.conf or any included config file.

Common situations: Typing `include` intending to add the path later, template placeholders left empty, or trailing include lines with the path accidentally deleted during editing.

Related errors


AI-assisted analysis of kovidgoyal/kitty@6d5d0c4406 (2026-08-27). Data as JSON: /api/errors/5e2c60cc6adda495. Report an issue: GitHub.