{"record":{"id":"e501d44e0ebff0ee","repo":"JuliusBrussee/caveman","slug":"kilo-config-root-resolves-to-an-empty-path","errorCode":null,"errorMessage":"Kilo config root resolves to an empty path","messagePattern":"Kilo config root resolves to an empty path","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/cli/src/index.ts","lineNumber":10790,"sourceCode":"\n// Kilo 7.5.6's native config writer targets KILO_CONFIG_DIR when present. That\n// directory is also loaded after KILO_CONFIG, so it must win for effective MCP\n// ownership. Explicit KILO_CONFIG wins only without a custom config directory;\n// xdg-basedir is the final fallback.\nfunction kiloConfigLocation(): KiloConfigLocation {\n  const configuredDirectory = process.env.KILO_CONFIG_DIR;\n  if (configuredDirectory) {\n    return kiloConfigInDirectory(kiloPathFromEnv(configuredDirectory, \"KILO_CONFIG_DIR\"), \"KILO_CONFIG_DIR\");\n  }\n  const explicit = process.env.KILO_CONFIG;\n  if (explicit) {\n    const path = kiloPathFromEnv(explicit, \"KILO_CONFIG\");\n    return { path, jsonc: extname(path).toLowerCase() === \".jsonc\", source: \"KILO_CONFIG\" };\n  }\n  // Pinned Kilo strips accidental newlines from xdg-basedir output before use.\n  const configuredRoot = process.env.XDG_CONFIG_HOME || join(homedir(), \".config\");\n  const cleanedRoot = configuredRoot.replace(/[\\r\\n]+/g, \"\");\n  if (!cleanedRoot) throw new Error(\"Kilo config root resolves to an empty path\");\n  const root = normalize(isAbsolute(cleanedRoot) ? cleanedRoot : resolve(cleanedRoot));\n  return kiloConfigInDirectory(join(root, \"kilo\"), \"XDG_CONFIG_HOME\");\n}\n\nfunction kiloConfigPath(): string {\n  return kiloConfigLocation().path;\n}\n\nfunction kiloMcpEntry(mcp: { command: string; args: string[] }): Record<string, unknown> {\n  return {\n    type: \"local\",\n    command: [mcp.command, ...mcp.args],\n    enabled: true,\n  };\n}\n\nfunction kiloMcpEntryMatches(value: unknown, mcp: { command: string; args: string[] }): boolean {\n  if (!value || typeof value !== \"object\" || Array.isArray(value)) return false;","sourceCodeStart":10772,"sourceCodeEnd":10808,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/5184b3d11ac6a1acb7d44b9bfaa31698157cff97/packages/cli/src/index.ts#L10772-L10808","documentation":"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.","triggerScenarios":"Thrown at packages/cli/src/index.ts:10790 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set KILO_CONFIG_DIR or KILO_CONFIG to a non-empty absolute directory path","Unset the empty-valued Kilo environment variables so the XDG fallback is used","Fix scripts that export these variables with unset or whitespace-only expansions"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5184b3d11ac6a1acb7d44b9bfaa31698157cff97","analyzedAt":"2026-09-06T12:00:26.372Z","contentChangedAt":"2026-09-06T12:00:26.372Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}