Skip to content

[Bug] Critical crash when optional .kilocode/rules directory is missing #27311

Description

@Darkshadenl

What happened?

When running the Gemini CLI in a workspace that does not contain a .kilocode/rules directory, the application crashes completely. Although the CLI correctly identifies that the directory is missing and logs a [WARN] message, it immediately throws a fatal error that halts execution, rendering the tool unusable in such environments:

[WARN] Skipping unreadable directory: .kilocode/rules (Directory does not exist: /Users/{user}/Repositories/Breijer/.kilocode/rules) An unexpected critical error occurred:Error: Directory does not exist: /Users/{user}/Repositories/Breijer/.kilocode/rules at WorkspaceContext.resolveAndValidateDir (file:///opt/homebrew/Cellar/gemini-cli/0.42.0/libexec/lib/node_modules/@google/gemini-cli/bundle/chunk-7VVHSNDQ.js:308296:13) ...

What did you expect to happen?

The .kilocode/rules directory should be treated as optional. If the directory does not exist, the CLI should simply continue execution (the existing warning is sufficient), rather than throwing a critical error that forces the application to terminate.


Reproduction Steps

  1. Add some folder (.kilocode/rules in this case) to settings.json
  2. Open a terminal in a directory that does not contain a .kilocode/rules folder.
  3. Execute a direct command, e.g.: ggg --prompt "test"
  4. The CLI logs the warning about the missing folder and then crashes with the stack trace provided above.

settings.json:
"context": { "fileName": [ "AGENTS.md", "GEMINI.md", "CLAUDE.md" ], "includeDirectories": [ ".kilocode/rules", ".cursor/rules" ], "loadFromIncludeDirectories": true, "fileFiltering": { "respectGitIgnore": false } },


Environment Info

  • CLI Version: 0.42.0
  • OS: Darwin (macOS)
  • Path: /opt/homebrew/Cellar/gemini-cli/0.42.0/

Client information

Client Information

Run gemini to enter the interactive CLI, then run the /about command.

> /about
╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│                                                                                                                                                                                                                                                │
│ About Gemini CLI                                                                                                                                                                                                                               │
│                                                                                                                                                                                                                                                │
│ CLI Version                                                                        0.42.0                                                                                                                                                      │
│ Git Commit                                                                         68e2196d5                                                                                                                                                   │
│ Model                                                                              gemini-2.5-flash-lite                                                                                                                                       │
│ Sandbox                                                                            no sandbox                                                                                                                                                  │
│ OS                                                                                 darwin                                                                                                                                                      │
│ Auth Method                                                                        Signed in with Google ({email}@gmail.com)                                                                                                        │
│ Tier                                                                               Gemini Code Assist in Google One AI Pro                                                                                                                     │
│                                                                                                                                                                                                                                                │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

Login information

Google Account

Anything else we need to know?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/coreIssues related to User Interface, OS Support, Core Functionalityeffort/small1 day or less: trivial logic, UI adjustments, docskind/bugpriority/p1Important and should be addressed in the near term.status/bot-triaged

    Type

    Fields

    No fields configured for Bug.

    Projects

    Status
    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions