Salt file.append crashes due to python error

I am trying to use salt and file.append to configure a file and I’m running into a python error.

I am running file.append in a qube based on a debian-12-minimal template.

There seems to be open issues on github for this error, however from the comments it seems like there was an attempt at a backport fix for qubes for newer templates? Is debian-12-minimal excluded from this backport?
From what I can tell @unman 's configuration files use this template and use file.append which leads me to believe this should be possible?

One suggestion was to not use file.append, what is a suggested alternative to this?

Salt tracking issue: [BUG] file.py _get_flags issue · Issue #62676 · saltstack/salt · GitHub
Qubes tracking issue: Fedora 37 fails to update via salt. · Issue #7891 · QubesOS/qubes-issues · GitHub

salt code:

/home/user/foo:
  file.append:
    - text:
      - 'bar'

Error:

2024-07-05 18:44:11,894 output:           ID: /home/user/foo
2024-07-05 18:44:11,894 output:     Function: file.append
2024-07-05 18:44:11,894 output:       Result: False
2024-07-05 18:44:11,894 output:      Comment: An exception occurred in this state: Traceback (most recent call last):
2024-07-05 18:44:11,894 output:                 File "/var/tmp/.root_dd8a91_salt/pyall/salt/state.py", line 2171, in call
2024-07-05 18:44:11,894 output:                   ret = self.states[cdata["full"]](
2024-07-05 18:44:11,894 output:                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-07-05 18:44:11,894 output:                 File "/var/tmp/.root_dd8a91_salt/pyall/salt/loader.py", line 2105, in wrapper
2024-07-05 18:44:11,894 output:                   return f(*args, **kwargs)
2024-07-05 18:44:11,895 output:                          ^^^^^^^^^^^^^^^^^^
2024-07-05 18:44:11,895 output:                 File "/var/tmp/.root_dd8a91_salt/pyall/salt/states/file.py", line 6301, in append
2024-07-05 18:44:11,895 output:                   if __salt__["file.search"](
2024-07-05 18:44:11,895 output:                      ^^^^^^^^^^^^^^^^^^^^^^^^
2024-07-05 18:44:11,895 output:                 File "/var/tmp/.root_dd8a91_salt/pyall/salt/modules/file.py", line 3154, in search
2024-07-05 18:44:11,895 output:                   return replace(
2024-07-05 18:44:11,895 output:                          ^^^^^^^^
2024-07-05 18:44:11,895 output:                 File "/var/tmp/.root_dd8a91_salt/pyall/salt/modules/file.py", line 2530, in replace
2024-07-05 18:44:11,895 output:                   flags_num = _get_flags(flags)
2024-07-05 18:44:11,895 output:                               ^^^^^^^^^^^^^^^^^
2024-07-05 18:44:11,895 output:                 File "/var/tmp/.root_dd8a91_salt/pyall/salt/modules/file.py", line 1653, in _get_flags
2024-07-05 18:44:11,895 output:                   _flag = getattr(re, str(flag).upper())
2024-07-05 18:44:11,895 output:                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-07-05 18:44:11,895 output:               AttributeError: module 're' has no attribute 'RE.MULTILINE'

What template are you using for your default-mgmt-dvm?
Update that template to fedora-40, and update the template.No issues
with debian-12-minimal.

I never presume to speak for the Qubes team.
When I comment in the Forum I speak for myself.