JuliusBrussee/caveman · error · Error

Kilo config root resolves to an empty path

Error message

Kilo config root resolves to an empty path

What it means

Sanity check in kiloConfigLocation: after resolving KILO_CONFIG_DIR / KILO_CONFIG / XDG fallbacks, the computed Kilo configuration directory is an empty string. The environment variables are set to values that collapse to an empty path, so config lookup cannot proceed safely.

Source

Thrown at packages/cli/src/index.ts:10790

// Kilo 7.5.6's native config writer targets KILO_CONFIG_DIR when present. That
// directory is also loaded after KILO_CONFIG, so it must win for effective MCP
// ownership. Explicit KILO_CONFIG wins only without a custom config directory;
// xdg-basedir is the final fallback.
function kiloConfigLocation(): KiloConfigLocation {
  const configuredDirectory = process.env.KILO_CONFIG_DIR;
  if (configuredDirectory) {
    return kiloConfigInDirectory(kiloPathFromEnv(configuredDirectory, "KILO_CONFIG_DIR"), "KILO_CONFIG_DIR");
  }
  const explicit = process.env.KILO_CONFIG;
  if (explicit) {
    const path = kiloPathFromEnv(explicit, "KILO_CONFIG");
    return { path, jsonc: extname(path).toLowerCase() === ".jsonc", source: "KILO_CONFIG" };
  }
  // Pinned Kilo strips accidental newlines from xdg-basedir output before use.
  const configuredRoot = process.env.XDG_CONFIG_HOME || join(homedir(), ".config");
  const cleanedRoot = configuredRoot.replace(/[\r\n]+/g, "");
  if (!cleanedRoot) throw new Error("Kilo config root resolves to an empty path");
  const root = normalize(isAbsolute(cleanedRoot) ? cleanedRoot : resolve(cleanedRoot));
  return kiloConfigInDirectory(join(root, "kilo"), "XDG_CONFIG_HOME");
}

function kiloConfigPath(): string {
  return kiloConfigLocation().path;
}

function kiloMcpEntry(mcp: { command: string; args: string[] }): Record<string, unknown> {
  return {
    type: "local",
    command: [mcp.command, ...mcp.args],
    enabled: true,
  };
}

function kiloMcpEntryMatches(value: unknown, mcp: { command: string; args: string[] }): boolean {
  if (!value || typeof value !== "object" || Array.isArray(value)) return false;

View on GitHub (pinned to 5184b3d11a)

Solutions

  1. Set KILO_CONFIG_DIR or KILO_CONFIG to a non-empty absolute directory path
  2. Unset the empty-valued Kilo environment variables so the XDG fallback is used
  3. Fix scripts that export these variables with unset or whitespace-only expansions
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/cli/src/index.ts:10790 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of JuliusBrussee/caveman@5184b3d11a (2026-09-06). Data as JSON: /api/errors/e501d44e0ebff0ee. Report an issue: GitHub.