Fixes · Checked on 2026-10-04
The string is missing the terminator: "
A bash-style \" inside a PowerShell string. Agents write them out of habit.
The error
PS> rg "said \"hi" src
ParserError:
Line |
1 | rg "said \"hi" src
| ~~~~~
| The string is missing the terminator: ".
Windows PowerShell 5.1 reports the same, as TerminatorExpectedAtEndOfString.
Why it happens
In bash, \" puts a quote inside a double-quoted string. In PowerShell the backslash is an ordinary
character, so "said \" is a whole string that ends at the second quote. Then hi"
opens another string that never closes.
The fix
Use PowerShell's own escapes:
- Single quotes when you need no variables. Nothing inside them is special:
'said "hi'. - A backtick before the quote inside double quotes:
"said `"hi".
Quotes inside arguments to rg, git or python
Even once PowerShell parses the line, a quote inside an argument to another program may not arrive. PowerShell 7 passes it as you typed it. Windows PowerShell 5.1 drops it without a word, so a search finds nothing and doesn't say why:
PowerShell 7 finds it with the quotes as typed. In 5.1, rg gets cfg[items] and finds nothing:
rg -F -e 'cfg["items"]' src
5.1 needs them escaped for the program. In 7, rg then gets the backslashes too, and finds nothing:
rg -F -e 'cfg[\"items\"]' src
To write it once for both, put the text in a file and let the program read it from there:
Set-Content patterns.txt 'cfg["items"]'
rg -F -f patterns.txt src
For code with quotes in it, the same goes for Python: write a .py file and run it, instead of python -c.
How DMN learned it
It came up, and was fixed, in 7 of our own sessions. DMN kept the fix as one line:
In PowerShell, rg patterns containing \" or [[] fail to parse; pass each literal as a single-quoted -e
'pattern' with -F, or escape brackets as \[ instead.
Checking it for this page showed the single-quoted
form loses its double quotes in Windows PowerShell 5.1, hence the pattern file above.
DMN reads your agents' past sessions on your machine. When the same error is fixed the same way in two or more of them, it keeps the fix as a one-line lesson. When the error turns up again, Claude Code is told the fix straight away, and any agent can search what earlier sessions found. How DMN keeps what agents learn.