Problem (one or two sentences)
Sometimes apply_diff starts refusing to work even though the content matches 100%. The reason is :start_line:N sometimes being malformed as :start_line=N or :start_line>N etc.
Context (who is affected and when)
Happens after a while when the model's context fills up.
Reproduction steps
Just running the usual editing loop. Here's the message:
<error_details>
No sufficiently similar match found (92% similar, needs 100%)
Debug Info:
- Similarity Score: 92%
- Required Threshold: 100%
- Search Range: start to end
- Tried both standard and aggressive line number stripping
- Tip: Use the read_file tool to get the latest content of the file before attempting to use the apply_diff tool again, as the file content may have changed
Search Content:
:start_line=18
-------
// MatrixConfig holds Matrix connection settings.
type MatrixConfig struct {
HomeserverURL string `yaml:"homeserver_url"`
AccessToken string `yaml:"access_token"`
UserID string `yaml:"user_id"`
BotDisplayName string `yaml:"bot_display_name"`
Rooms []string `yaml:"rooms"`
}
Best Match Found:
16 | }
17 |
18 | // MatrixConfig holds Matrix connection settings.
19 | type MatrixConfig struct {
20 | HomeserverURL string `yaml:"homeserver_url"`
21 | AccessToken string `yaml:"access_token"`
22 | UserID string `yaml:"user_id"`
23 | BotDisplayName string `yaml:"bot_display_name"`
24 | Rooms []string `yaml:"rooms"`
25 | }
Original Content:
1 | package config
2 |
3 | import (
4 | "fmt"
5 | "os"
6 |
7 | "gopkg.in/yaml.v3"
8 | )
9 |
10 | // Config holds all configuration for the bot.
11 | type Config struct {
12 | Matrix MatrixConfig `yaml:"matrix"`
13 | LLM LLMConfig `yaml:"llm"`
14 | Personality PersonalityConfig `yaml:"personality"`
15 | Context ContextConfig `yaml:"context"`
16 | }
17 |
18 | // MatrixConfig holds Matrix connection settings.
19 | type MatrixConfig struct {
20 | HomeserverURL string `yaml:"homeserver_url"`
21 | AccessToken string `yaml:"access_token"`
22 | UserID string `yaml:"user_id"`
23 | BotDisplayName string `yaml:"bot_display_name"`
24 | Rooms []string `yaml:"rooms"`
25 | }
26 |
27 | // LLMConfig holds LLM API settings.
28 | type LLMConfig struct {
29 | APIKey string `yaml:"api_key"`
30 | BaseURL string `yaml:"base_url"` // Optional custom base URL
31 | Model string `yaml:"model"`
32 | MaxTokens int `yaml:"max_tokens"`
33 | Temperature float64 `yaml:"temperature"`
34 | }
35 |
36 | // PersonalityConfig holds bot personality settings.
37 | type PersonalityConfig struct {
38 | Name string `yaml:"name"`
39 | Description string `yaml:"description"`
40 | Traits []string `yaml:"traits"`
41 | Tone string `yaml:"tone"`
42 | LanguagePref string `yaml:"language_preference"`
43 | }
44 |
45 | // ContextConfig holds chat context settings.
46 | type ContextConfig struct {
47 | MaxHistoryMessages int `yaml:"max_history_messages"`
48 | MaxContextTokens int `yaml:"max_context_tokens"`
49 | }
</error_details>
And another one:
<error_details>
No sufficiently similar match found (83% similar, needs 100%)
Debug Info:
- Similarity Score: 83%
- Required Threshold: 100%
- Search Range: start to end
- Tried both standard and aggressive line number stripping
- Tip: Use the read_file tool to get the latest content of the file before attempting to use the apply_diff tool again, as the file content may have changed
Search Content:
:start_line=195
-------
// Check for /reset command
if strings.HasPrefix(body, "/reset") {
if evt.Sender.String() == cfg.Matrix.UserID {
Best Match Found:
193 | }
194 |
195 | // Check for /reset command
196 | if strings.HasPrefix(body, "/reset") {
197 | if evt.Sender.String() == cfg.Matrix.UserID {
Expected result
The error message explains that the mandatory :start_line:N line is missing and proposes the correct format.
Actual result
apply_diff complains about insufficient match
Variations tried (optional)
No response
App Version
Version: 3.53.0 (44f6bba)
API Provider (optional)
OpenAI Compatible
Model Used (optional)
Qwen3.6 35B A3B APEX
Roo Code Task Links (optional)
No response
Relevant logs or errors (optional)
Problem (one or two sentences)
Sometimes apply_diff starts refusing to work even though the content matches 100%. The reason is
:start_line:Nsometimes being malformed as:start_line=Nor:start_line>Netc.Context (who is affected and when)
Happens after a while when the model's context fills up.
Reproduction steps
Just running the usual editing loop. Here's the message:
And another one:
Expected result
The error message explains that the mandatory
:start_line:Nline is missing and proposes the correct format.Actual result
apply_diff complains about insufficient match
Variations tried (optional)
No response
App Version
Version: 3.53.0 (44f6bba)
API Provider (optional)
OpenAI Compatible
Model Used (optional)
Qwen3.6 35B A3B APEX
Roo Code Task Links (optional)
No response
Relevant logs or errors (optional)