Skip to content

re.PatternError: bad escape \s at position ... #39

@filiprem-clickup

Description

@filiprem-clickup

After enabling openai integration I see this error with 2 local commits ahead of main. Both PRs already exists.

Version: 701a0f1

Python 3.13.1

(.venv) ~/repos/clickup_dbas $ git grok
Processing commit: fix(db-ops): Increase length of query substring captured in diagnostic queries
  ── base: origin/grok/filiprem-clickup/feat-db-ops-simple-datadog-client-to-main-a889 (up-to-date)
  ── head: origin/grok/filiprem-clickup/fix-db-ops-increase-length-of-query-substring-captured-in-diagnostic-queries-to-main-99dc (up-to-date)
  ── generating PR description with AI (patience!)
Traceback (most recent call last):
  File "/Users/filip/bin/git-grok", line 2141, in <module>
    sys.exit(Main().run())
             ~~~~~~~~~~^^
  File "/Users/filip/bin/git-grok", line 334, in run
    self.run_in_rebase_interactive(data=self.in_rebase_interactive)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/filip/bin/git-grok", line 496, in run_in_rebase_interactive
    new_pr_body = self.process_build_pr_body_with_ai(
        commit=commit,
        pr_template=pr_template,
    )
  File "/Users/filip/bin/git-grok", line 783, in process_build_pr_body_with_ai
    return body_build_from_injected_text(injected_text=injected_text)
  File "/Users/filip/bin/git-grok", line 2036, in body_build_from_injected_text
    return re.sub(
           ~~~~~~^
        r"\s*" + re.escape(AI_PLACEHOLDER) + r"\s*",
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        f"\n\n{injected_text.text}\n\n",
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        injected_text.template_with_placeholder,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/re/__init__.py", line 208, in sub
    return _compile(pattern, flags).sub(repl, string, count)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/re/__init__.py", line 377, in _compile_template
    return _sre.template(pattern, _parser.parse_template(repl, pattern))
                                  ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/re/_parser.py", line 1076, in parse_template
    raise s.error('bad escape %s' % this, len(this)) from None
re.PatternError: bad escape \s at position 548 (line 8, column 1)
warning: execution failed: GIT_GROK_in_rebase_interactive=2/2 /Users/filip/bin/git-grok
Command "git rebase --quiet --interactive '99dc2ec0e31f7e51ad7a22184239c1f250bad547^'" returned status 1.
(.venv) ~/repos/clickup_dbas $ 

The exact position differs between runs, eg.

re.PatternError: bad escape \s at position 463 (line 8, column 1)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions