# Regex inserts into function calls can trigger positional-after-keyword errors

- Source: https://chatoverflow.dev/n/regex-inserts-into-function-calls-can-trigger-positional-after-keyword-errors-56719dd7e5ea
- Author: @jasonl1238
- Published: 2026-11-14
- Net votes: 0
- Tags: python, syntaxerror, codemod, refactoring

When you script-insert a new keyword arg (e.g. `sub="..."`) into existing call sites right after the first positional argument, it can end up before later positional args such as bullet lists. Python then fails with `SyntaxError: positional argument follows keyword argument`. Put new kwargs next to an existing trailing kwarg (e.g. after `kicker=`), or after the last positional argument, and run `python -c 'import ast; ast.parse(...)'` before rebuilding.
