Deployment is not working

Hi, I’m trying to deploy a Telegram bot to have it 24/7 online, but it crashes few seconds after the deploy. As you can see in the screen, the error is “hostingpid1: an open port was not detected”.
I’m using a Reserved VM (0.5 vCPU / 2 GiB RAM)

Does anyone know how to solve it?

Thanks in advance

Screenshots, links, or other helpful context:

I just tried with another telegram bot and there was the same error.

Moreover I also tried with a discord bot and it also crashed immediately In this case the error is different and is
“error: The deployment failed to initialize due to a configuration or code error. Check the logs tab for more information. For additional support, please post on and a staff member will take a look. - 2023-10-20T20:58:08.387Z”

All the 3 bots mentioned in this thread work properly if I click run from the Repl

Please I need a solution asap

Thank you in advance

Can you send us a screenshot of the log tab of your deployment?


here are the screenshots of the log tab of the two telegram bots

Schermata 2023-10-21 alle 11.28.32

instead, on the discord bot, the log tab is completely empty and this is the issue

has anyone a solution?

When you run your bots outside of deployment, no errors occur?

You can also send the contents of the .replit file to one of the bots.

yes, the bots work properly outside of deployment.

regarding “you can also send the contents of the .replit file to one of the bots”, you mean that I have to paste here the content of a .replit file?

Yes. In the .replit file there is a run parameter, which specifies the command to start the repl, as well as other important information for deployment.

this is the content of the .replit file for a telegram bot:

# The command that runs the program. If the interpreter field is set, it will have priority and this run command will do nothing
run = "python3"

# The primary language of the repl. There can be others, though!
language = "python3"
entrypoint = ""
# A list of globs that specify which files and directories should
# be hidden in the workspace.
hidden = ["venv", ".config", "**/__pycache__", "**/.mypy_cache", "**/*.pyc"]

# Specifies which nix channel to use when building the environment.
channel = "stable-22_11"

# The command to start the interpreter.
  args = [
    "\u0001\u001b[33m\u0002\u0001\u001b[00m\u0002 ",

VIRTUAL_ENV = "/home/runner/${REPL_SLUG}/venv"
PYTHONPATH = "$PYTHONHOME/lib/python3.10:${VIRTUAL_ENV}/lib/python3.10/site-packages"
POETRY_CACHE_DIR = "${HOME}/${REPL_SLUG}/.cache/pypoetry"

# Enable unit tests. This is only supported for a few languages.
language = "python3"

# Add a debugger!
support = true

  # How to start the debugger.
  transport = "localhost:0"
  startCommand = ["dap-python", ""]

    # How to communicate with the debugger.
    dapTcpAddress = "localhost:0"

    # How to tell the debugger to start a debugging session.
    command = "initialize"
    type = "request"

      adapterID = "debugpy"
      clientID = "replit"
      clientName = ""
      columnsStartAt1 = true
      linesStartAt1 = true
      locale = "en-us"
      pathFormat = "path"
      supportsInvalidatedEvent = true
      supportsProgressReporting = true
      supportsRunInTerminalRequest = true
      supportsVariablePaging = true
      supportsVariableType = true

    # How to tell the debugger to start the debuggee application.
    command = "attach"
    type = "request"

      logging = {}

# Configures the packager.
language = "python3"
ignoredPackages = ["unit_tests"]

  enabledForHosting = false
  # Enable searching packages from the sidebar.
  packageSearch = true
  # Enable guessing what packages are needed from the code.
  guessImports = true

# These are the files that need to be preserved when this 
# language template is used as the base language template
# for Python repos imported from GitHub
requiredFiles = [".replit", "replit.nix", ".config", "venv"]


pattern = "**/*.py"

start = "pylsp"

run = ["sh", "-c", "python3"]

Instead, this is the content of the .replit discord bot, that is not running with deployments as well

entrypoint = ""
modules = ["python-3.10:v18-20230807-322e88b"]

hidden = [".pythonlibs"]

channel = "stable-23_05"

run = ["python3", ""]
deploymentTarget = "gce"

I’m available to do whatever it takes to make the bots online :slight_smile:

at the moment I’m wasting cycles and so money, because these 3 bots are charging cycles also if they are not working.

  1. is it possible to ask a refund?
  2. do you suggest me to stop them so I stop to waste money, or I need to have them active waiting for your answer, to solve the issue?

Unfortunately, I can’t say why your bots don’t work in an expanded form. We need to wait for help from other community members. The solution to your problem may not be found soon, so you should disable bots until a solution is found.

@RicascoLTD Sorry for the delayed response. Try setting the type of the deployment to “Background Worker” instead of “Web Server”. This is an option available at the bottom of the deployments pane right before you hit the deploy button.


To answer the question more generally, the error “hostingpid1: an open port was not detected” means that the deployment expected your application to start listening on a port on the address (because it thinks you’re running a web server). You have to explicitly tell the deployment that it’s a background worker if you aren’t serving HTTP traffic on a port.


thank you so much! now all the bot are working except one.

As you can see in the screen, in this telegram bot the 3 secrets are out of sync, but when I simply click run on the repl (so without deployments), the bot works properly

is there any reason?

Schermata 2023-10-25 alle 14.15.14

The secrets in the deployment and in the workspace are different. When you edit secrets in the secrets pane, those apply to the workspace, but when you edit them in the deployment pane, those affect the deployment. If we detect a difference then we prompt you to synchronize them, which copies over your secrets from the workspace into the deployment. If you change them in the deployment pane, you’ll need to re-deploy in order for those to be applied.

1 Like