gemini-cli icon indicating copy to clipboard operation
gemini-cli copied to clipboard

Bug: chat resume fails for tags with spaces/special characters

Open hebenezer-m opened this issue 1 year ago • 1 comments

Bug: chat resume fails for tags containing spaces or special characters

Description: The Gemini CLI's /chat resume command fails to load saved chat sessions when the provided tag contains spaces or special characters. The CLI incorrectly transforms the tag into a filename by removing these characters, leading to an ENOENT (file not found) error.

Version: CLI Version 0.1.14 Git Commit de968877 (local modifications) Model gemini-2.5-flash Sandbox no sandbox OS linux Auth Method OAuth

Operating System: Linux

Steps to Reproduce:

  1. Start a Gemini CLI session.
  2. Save a chat session using a tag that includes spaces or special characters. For example:
    /chat save "TAG_WITH_SPACES_AND_SPECIAL_CHARS"
    
    (This creates a file like checkpoint-TAG_WITH_SPACES_AND_SPECIAL_CHARS.json in the session directory.)
  3. Exit and restart the Gemini CLI.
  4. Attempt to resume the saved session using the exact same tag:
    /chat resume "TAG_WITH_SPACES_AND_SPECIAL_CHARS"
    
  5. Observe the error message in the terminal:
    ℹ No saved checkpoint found with tag: TAG_WITH_SPACES_AND_SPECIAL_CHARS
    
  6. Check the debug console (Ctrl+O) for detailed error messages.

Expected Behavior: The Gemini CLI should successfully resume the chat session when the exact tag (including spaces and special characters) is provided to /chat resume, as listed by /chat list. It should correctly locate and load the corresponding checkpoint file.

Observed Behavior: The Gemini CLI fails to resume the session. Despite the tag being correctly listed by /chat list, the CLI attempts to open a checkpoint file where spaces and special characters have been removed from the tag in the filename. This results in an ENOENT error because the constructed filename does not match the actual filename on disk.

Debug Console Output:

ℹ  Loaded cached credentials.
ℹ  Authenticated via "oauth-personal".
✖  Failed to read or parse checkpoint file
   /home/hebenezer/.gemini/tmp/01405b541f7a084dc4b353d6bf18b964b64ad265cfe13a8ac370f0f6c6ad58b2/checkpoint-TAG_WITHOUT_SPACES_OR_SPECIAL_CHARS.json: Error: ENOENT: no such file or directory, open
   '/home/hebenezer/.gemini/tmp/01405b541f7a084dc4b353d6bf18b964b64ad265cfe13a8ac370f0f6c6ad58b2/checkpoint-TAG_WITHOUT_SPACES_OR_SPECIAL_CHARS.json'
       at async open (node:internal/fs/promises:639:25)
       at async Object.readFile (node:internal/fs/promises:1243:14)
       at async Logger.loadCheckpoint
   (file:///home/hebenezer/.config/nvm/versions/node/v22.17.0/lib/node_modules/@google/gemini-cli/node_modules/@google/gemini-cli-core/dist/src/core/logger.js:215:33)
       at async Object.action
   (file:///home/hebenezer/.config/nvm/versions/node/v22.17.0/lib/node_modules/@google/gemini-cli/dist/src/ui/commands/chatCommand.js:126:30)
       at async
   file:///home/hebenezer/.config/nvm/versions/node/v22.17.0/lib/node_modules/@google/gemini-cli/dist/src/ui/hooks/slashCommandProcessor.js:196:32
       at async
   file:///home/hebenezer/.config/nvm/versions/node/v22.17.0/lib/node_modules/@google/gemini-cli/dist/src/ui/hooks/useGeminiStream.js:126:40
       at async
   file:///home/hebenezer/.config/nvm/versions/node/v22.17.0/lib/node_modules/@google/gemini-cli/dist/src/ui/hooks/useGeminiStream.js:399:48 {
     errno: -2,
     code: 'ENOENT',
     syscall: 'open',
     path:
   '/home/hebenezer/.gemini/tmp/01405b541f7a084dc4b353d6bf18b964b64ad265cfe13a8ac370f0f6c6ad58b2/checkpoint-TAG_WITHOUT_SPACES_OR_SPECIAL_CHARS.json'
   } (x5)
✖  Failed to read or parse checkpoint file
   /home/hebenezer/.gemini/tmp/01405b541f7a084dc4b353d6bf18b964b64ad265cfe13a8ac370f0f6c6ad58b2/checkpoint-ANOTHER_TAG_WITHOUT_SPACES_OR_SPECIAL_CHARS.json: Error: ENOENT: no such file or directory, open
   '/home/hebenezer/.gemini/tmp/01405b541f7a084dc4b353d6bf18b964b64ad265cfe13a8ac370f0f6c6ad58b2/checkpoint-ANOTHER_TAG_WITHOUT_SPACES_OR_SPECIAL_CHARS.json'
       at async open (node:internal/fs/promises:639:25)
       at async Object.readFile (node:internal/fs/promises:1243:14)
       at async Logger.loadCheckpoint
   (file:///home/hebenezer/.config/nvm/versions/node/v22.17.0/lib/node_modules/@google/gemini-cli/node_modules/@google/gemini-cli-core/dist/src/core/logger.js:215:33)
       at async Object.action
   (file:///home/hebenezer/.config/nvm/versions/node/v22.17.0/lib/node_modules/@google/gemini-cli/dist/src/ui/commands/chatCommand.js:126:30)
       at async
   file:///home/hebenezer/.config/nvm/versions/node/v22.17.0/lib/node_modules/@google/gemini-cli/dist/src/ui/hooks/slashCommandProcessor.js:196:32
       at async
   file:///home/hebenezer/.config/nvm/versions/node/v22.17.0/lib/node_modules/@google/gemini-cli/dist/src/ui/hooks/useGeminiStream.js:126:40
       at async
   file:///home/hebenezer/.config/nvm/versions/node/v22.17.0/lib/node_modules/@google/gemini-cli/dist/src/ui/hooks/useGeminiStream.js:399:48 {
     errno: -2,
     code: 'ENOENT',
     syscall: 'open',
     path:
   '/home/hebenezer/.gemini/tmp/01405b541f7a084dc4b353d6bf18b964b64ad265cfe13a8ac370f0f6c6ad58b2/checkpoint-ANOTHER_TAG_WITHOUT_SPACES_OR_SPECIAL_CHARS.json'
   }

hebenezer-m avatar Jul 26 '25 18:07 hebenezer-m

Duplicate: https://github.com/google-gemini/gemini-cli/issues/5340

hugomurillomtz avatar Aug 13 '25 22:08 hugomurillomtz