Skip to content

Conversation

@ThanhNguyxn
Copy link

Summary

Fixes #4719

Changed str.format() to str.replace() in get_commit_message() to prevent KeyError when custom commit prompts contain curly braces like {message}.

Root Cause

The code used:

system_content = system_content.format(language_instruction=language_instruction)

When custom --commit-prompt contains {message} or other {placeholder}, Python raises KeyError.

Fix

system_content = system_content.replace("{language_instruction}", language_instruction)

This only substitutes the specific placeholder without interpreting other curly braces.

Fixes Aider-AI#4719

The get_commit_message function used str.format() to substitute
{language_instruction} in the commit prompt. If a user provides a
custom --commit-prompt that contains other curly braces like {message},
this causes a KeyError.

Changed str.format() to str.replace() to only substitute the specific
placeholder without interpreting other curly brace patterns.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Uncaught KeyError in repo.py line 339

1 participant