Try the demo

sed: unknown option to `s'

Almost always a path with slashes in it, or a backslash in the wrong place.

The errors

sed: -e expression #1, char 11: unknown option to `s'
sed: -e expression #1, char 10: unterminated `s' command

Why they happen

s/old/new/ uses / to separate its parts. When old or new is a path, its slashes end the parts early, and sed reads what's left as options, like the g in /g:

sed -i 's/src/app/old.ts/src/app/new.ts/g' index.ts    # unknown option to `s'

A backslash right before the delimiter escapes it, so the command never ends: unterminated. A Windows path that ends in a backslash does it:

sed 's/old/C:\/' paths.txt    # unterminated `s' command

The fix

Use a delimiter that isn't in the text. Any character works after s:

sed -i 's#src/app/old.ts#src/app/new.ts#g' index.ts

For a coding agent, an edit tool is safer still: it replaces exact text, with no regex and no quoting to get wrong.

How DMN learned it

It came up, and was fixed, in 3 of our own sessions. DMN kept the fix as one line: When sed reports "unknown option to `s'", the s delimiter (/ or |) appears in the pattern or replacement; use a delimiter absent from the text, such as #, or use the Edit tool.

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.

Stop fixing the same error twice