Deployment Error: bad interpreter: No such file or directory

Problem description:
When I try to redeploy my application (which runs perfectly well and has been deployed countless times before without issues), I get the following error:

sh: /home/runner/c3a72543-84ae-4657-ad27-f27e07a46d48/venv/bin/flask: /home/runner/DLResurrect/venv/bin/python: bad interpreter: No such file or directory

The site runs perfectly well in the console and Webview, but just doesn’t deploy anymore.

Expected behavior:
Site should build and deploy smoothly as usual.

Actual behavior:
THe error I described above.

Steps to reproduce:
I with I knew.

The .replit file contains this code:

[env]
VIRTUAL_ENV = "/home/runner/${REPL_SLUG}/venv"
PATH = "${VIRTUAL_ENV}/bin"
PYTHONPATH = "${VIRTUAL_ENV}/lib/python3.10/site-packages"
REPLIT_POETRY_PYPI_REPOSITORY = "https://package-proxy.replit.com/pypi/"
MPLBACKEND = "TkAgg"
POETRY_CACHE_DIR = "${HOME}/${REPL_SLUG}/.cache/pypoetry"

Apparently, the ${REPL_SLUG} parameter is not being found on the deployment instance, even though the site works locally on Replit. This is 99% a problem on the Replit side.

Browser: Firefox
OS: Mac
Device (Android, iOS, NA leave blank): Macbook
Desktop app version (Avatar menu->“Version”) or NA:
Plan (Free, Hacker, Pro Plan): Hacker

started happening after you started using flask as the run command?
If you migrate to Nix modules it won’t use a venv, so the paths in the venv/bin/flask script won’t be hardcoded and this error should be resolved.