Skip to content

Gemini is not writing changes to .sh files #3785

Open
@timrichardson

Description

@timrichardson

Issue

Today I find that gemini is not writing changes to .sh files. It suggests edits, and says it has made them; I can see the diff output, but nothing happens.
If I want it to create a new file, therefore doing /add new_file.sh, it remains empty.

Example:

Readonly: aider_prompt.md                                                                                                                                                                                                                                                                                                                         
architect> /add test_hello.sh                                                                                                                                                                                                                                                                                                                     
 
No files matched 'test_hello.sh'. Do you want to create /home/tim/django_api_sync/test_hello.sh? (Y)es/(N)o [Yes]: y                                                                                                                                                                                                                              
Added test_hello.sh to the chat

Readonly: aider_prompt.md
Editable: test_hello.sh                                                                                                                                                                                                                                                                                                                           
architect> make test_hello.sh accept one command line argument, and echo it back                                                                                                                                                                                                                                                                  
 
Okay, Editor Engineer, please apply the following changes to test_hello.sh.                                                                                                                                                                                                                                                                       

Change Request:                                                                                                                                                                                                                                                                                                                                   

Modify the test_hello.sh script to:                                                                                                                                                                                                                                                                                                               

 1 Expect exactly one command-line argument.                                                                                                                                                                                                                                                                                                      
 2 Print the provided argument to standard output.                                                                                                                                                                                                                                                                                                
 3 If the number of arguments is incorrect, print a usage message to standard error and exit with a non-zero status code.                                                                                                                                                                                                                         

Instructions:                                                                                                                                                                                                                                                                                                                                     

Add the following content to the test_hello.sh file.                                                                                                                                                                                                                                                                                              

Code Changes:                                                                                                                                                                                                                                                                                                                                     

                                                                                                                                                                                                                                                                                                                                                  
#!/bin/bash                                                                                                                                                                                                                                                                                                                                       
                                                                                                                                                                                                                                                                                                                                                  
# Check if exactly one argument is provided                                                                                                                                                                                                                                                                                                       
if [ "$#" -ne 1 ]; then                                                                                                                                                                                                                                                                                                                           
    echo "Usage: $0 <argument>" >&2                                                                                                                                                                                                                                                                                                               
    exit 1                                                                                                                                                                                                                                                                                                                                        
fi                                                                                                                                                                                                                                                                                                                                                
                                                                                                                                                                                                                                                                                                                                                  
# Echo the first argument                                                                                                                                                                                                                                                                                                                         
echo "$1"                                                                                                                                                                                                                                                                                                                                         
                                                                                                                                                                                                                                                                                                                                                  
exit 0                                                                                                                                                                                                                                                                                                                                            
                                                                                                                                                                                                                                                                                                                                                  


Tokens: 10k sent, 163 received. Cost: $0.01 message, $0.06 session.
Edit the files? (Y)es/(N)o [Yes]: y                                                                                                                                                                                                                                                                                                               
Okay, I will add the provided bash script content to the test_hello.sh file.                                                                                                                                                                                                                                                                      

Here is the SEARCH/REPLACE block:                                                                                                                                                                                                                                                                                                                 

                                                                                                                                                                                                                                                                                                                                                  
test_hello.sh                                                                                                                                                                                                                                                                                                                                     
<<<<<<< SEARCH                                                                                                                                                                                                                                                                                                                                    
=======                                                                                                                                                                                                                                                                                                                                           
#!/bin/bash                                                                                                                                                                                                                                                                                                                                       
                                                                                                                                                                                                                                                                                                                                                  
# Check if exactly one argument is provided                                                                                                                                                                                                                                                                                                       
if [ "$#" -ne 1 ]; then                                                                                                                                                                                                                                                                                                                           
    echo "Usage: $0 <argument>" >&2                                                                                                                                                                                                                                                                                                               
    exit 1                                                                                                                                                                                                                                                                                                                                        
fi                                                                                                                                                                                                                                                                                                                                                
                                                                                                                                                                                                                                                                                                                                                  
# Echo the first argument                                                                                                                                                                                                                                                                                                                         
echo "$1"                                                                                                                                                                                                                                                                                                                                         
                                                                                                                                                                                                                                                                                                                                                  
exit 0                                                                                                                                                                                                                                                                                                                                            
>>>>>>> REPLACE                                                                                                                                                                                                                                                                                                                                   
                                                                                                                                                                                                                                                                                                                                                  


Tokens: 3.1k sent, 103 received. Cost: $0.0049 message, $0.07 session.
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Readonly: aider_prompt.md
Editable: test_hello.sh                                                                                                                                                                                                                                                                                                                           
architect>  

but

architect> ! cat test_hello.sh

Add 0.0k tokens of command output to the chat? (Y)es/(N)o [Yes]:
Added 0 lines of output to the chat.
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Readonly: aider_prompt.md
Editable: test_hello.sh
architect>

and indeed it is empty.

tim@ubuntu-dev-2024:~/django_api_sync (master)$ cat test_hello.sh 
tim@ubuntu-dev-2024:~/django_api_sync (master)$ 

 # Main model:
 # model: gemini/gemini-2.5-pro-exp-03-25
 model: gemini
 map-tokens: 8192
 map-refresh: files                # Refresh map when files change
 map-multiplier-no-files: 2        # Double map tokens when no files are added to chat
    
 # Editor model
 architect: true
 auto-accept-architect: false
 # Cache settings
 cache-prompts: true

 # Git settings
 auto-commits: false
 watch-files: true

 # UI settings
 dark-mode: true
 vim: true

 # Read-only files
 read:
   - aider_prompt.md

 # Editor
 editor: vim

 # Lint commands
 lint-cmd:
   - "django: djlint --lint"

 # History
 chat-history-file: .aider_history/.aider.chat.history.md 
 input-history-file: .aider_history/.aider.input.history
 llm-history-file: .aider_history/.aider.llm.history

Version and model info

tim@ubuntu-dev-2024:~$ aider --version
aider 0.81.2

aider config included above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingfixed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions