← All guides

Replit app not running or not loading? Fixes for deploys, secrets and ports

Replit

On Replit, Agent writes the code, Preview shows it at a replit.dev address, and publishing puts it on a replit.app address. A lot can break between those two places, because the published app is a separate copy with its own settings and its own database. If you’d rather hand the problem to someone, our Replit page takes a description of what’s broken. Otherwise, work through the steps below in order. Each one rules out a whole group of causes before you move on.

Step 0: Is it Replit, your browser, or your app?

Start with Replit’s status page. If an incident matches what you’re seeing, your code may be fine, and changing it can make things worse. Two recent examples from that page (dates in Pacific time, as the page lists them):

  • Nov 24–25, 2026: an Agent chat problem where a message you had just sent could disappear from the chat and come back once Agent answered. Replit said no messages were lost. The incident was open for about a day and is marked resolved.
  • Nov 26, 2026: paid plan upgrades weren’t activating after checkout. Affected customers were charged but kept their old plan, and a second purchase attempt could show a message that a subscription was already on file. Replit asked them not to pay again and applied the plans itself after the fix.

If the status page is clear and the Project Editor itself won’t load, freezes or goes white, Replit’s FAQ gives these checks:

  1. Check that your internet connection works.
  2. Switch browsers, and confirm JavaScript is turned on.
  3. Open the command palette (Cmd+K on Mac, Ctrl+K on Windows), type Restart compute and run it.
  4. If nothing changes and the status page shows no problem, contact Replit Support.

If your replit.app or replit.dev URL won’t open on one network but opens on another (your phone’s mobile data, for example), Replit’s publishing troubleshooting page points to web filters or network restrictions. Its suggested fix is a public DNS resolver, for example Google’s 8.8.8.8 or Cloudflare’s 1.1.1.1. The same page notes that replit.dev addresses can change during cluster migrations, so an old bookmarked Preview link may simply be out of date.

Step 1: Does it work in Preview?

Replit’s publishing troubleshooting page puts Preview first for a reason: publishing a project that’s broken in Preview won’t repair it.

Select Run and open Preview. If you don’t see your app at a replit.dev URL:

  • Read the Console output for the first error, not the last.
  • If Preview is blank but the server looks like it’s running, check the port setup in Step 4.
  • Paste the exact error into Agent and ask for a diagnosis before any edits:
Preview is blank. Here is the console output: <paste>.
Don't change code yet. Tell me what's causing it and what you'd change.

Step 2: Understand Preview vs. the published app

Replit’s Publishing page explains that publishing captures a snapshot of the project (its files plus installed dependencies) and runs that copy on Replit’s cloud as its own instance, apart from what you see in the editor. Three things follow:

  1. Edits aren’t live until you publish again. A fix in the editor changes nothing at your public URL until you republish.
  2. Secrets and the database can differ between the two. See Steps 3 and 5.
  3. Files written to disk don’t survive. The troubleshooting page warns that a published app’s filesystem is reset on every publish. If uploads or generated files vanish, they were saved to disk. Keep them in the database or App Storage instead.

To open publishing settings, Replit’s Publishing overview gives two routes: the Publish button in the editor’s top-right corner, or Tools → Replit Cloud → Publishing.

Pick the right deployment type

Replit lists four deployment types. You pick one from the Deployment type menu inside Adjust settings, and Autoscale is selected by default:

TypeGood forBehaviour
AutoscaleSites and APIs whose traffic goes up and downGrows to more servers under load, down to zero with no traffic
StaticLanding pages, portfolios, docsServes files only, no backend
Reserved VMBots, workers, APIs that must stay upA single dedicated machine that stays awake
ScheduledBackups, periodic jobs, notificationsRuns at set times, exits after each run, no public URL

Mismatches to check:

  • Static for an app with a server. The deployment types page says Static isn’t compatible with apps Agent created, because those come with a backend server. The troubleshooting page adds that API routes, login callbacks, server-side database calls and long-running backend logic make Static a poor fit. Switch to Autoscale (or Reserved VM). Replit’s Secrets doc also says secrets are available on every deployment type except Static.
  • Autoscale for a bot or background worker. Autoscale can drop to zero servers with no traffic, so a process that has to stay connected (a Discord bot, a queue worker) fits a Reserved VM better.
  • A script that runs once and exits. Replit expects a published app to keep running and restarts a program that exits. Use Scheduled for jobs. Web apps need a server that keeps listening.

Size limits apply too: 8 GB for Autoscale and Reserved VM apps, 1 GB for Static.

Publish error

If Preview is fine and only the publish fails, find the stage that broke. Replit’s page on database changes during publishing lists the order: security checks, build, the production database migration, then bundling and promoting the new version.

  • Read the logs first. The troubleshooting page sends you to the Publishing pane’s Logs tab. Replit’s publishing help also describes opening a failed deployment’s logs from its three-dot menu, or from Publishing → History, and reading from the earliest ERROR or FAILED line. Paste those lines into a new Agent chat.
  • Check the run and build commands in the Publishing pane for typos, the wrong entry file, or a command that runs on your laptop but not on Replit.
  • Security scan. The Publishing overview says Replit scans every publish, and a Block publishing of critical vulnerabilities setting under Adjust settings decides whether critical findings stop it.
  • Health check. Before going live, Replit sends your app an HTTP request. A homepage slower than five seconds can make the final step time out, according to the troubleshooting page. Move slow startup work out of the first request.
  • Stuck during build or migration. Replit’s publishing help suggests Restart compute, then Publish again, then sending the build log to Agent, and contacting support with full logs if it stays stuck.
  • A platform incident. Check the status page here too. On Nov 12, 2026 (Pacific time), Reserved VM publishes failed at the Promote stage with an “inspect shared VPC attachment” error, which the page lists as 35 minutes. On Dec 1–2, 2026 (Pacific time), publishing new apps and updating live ones failed for a little over two hours. Both are marked resolved on the page.

If publishing succeeds and the public URL then answers with a 500 error, Replit’s publishing help treats it as an app code problem: copy the full error from the publishing logs (strip any secret values) into a new Agent chat, fix, and republish. If you can’t find the cause, redeploy the last working version from Publishing → History while you keep looking.

Once the replit.app address works, a custom domain is the next place things can go wrong. Our guide to a Replit custom domain that won’t connect covers DNS records, the verification window and SSL.

Step 3: Secrets work in the editor but not when published

Replit’s docs don’t agree on how secrets reach a published app, so check rather than assume:

Either way, a production secret that’s missing can surface as an undefined value, an API call or database connection that fails, a broken login or a failed payment.

Check: open Publishing and select Adjust settings. The Secrets doc calls the section Production app secrets, and the Publishing overview calls it Deployment secrets. Compare it line by line with the Secrets tool in the editor (Tools, then Secrets under Setup). Every key your code reads (process.env.STRIPE_SECRET_KEY, os.environ["OPENAI_API_KEY"] and so on) has to exist in both places. After changing a production value, publish again: the help page says new values apply when the new deployment starts.

Use separate values on purpose. For non-secret settings that differ between testing and production, such as an API base URL or a feature flag, the Configurations section of the Secrets tool has New published app configuration and New testing configuration under More. You can also branch in code. Replit sets REPLIT_DEPLOYMENT to 1 in a published app and leaves it unset otherwise:

const isProd = process.env.REPLIT_DEPLOYMENT === "1";

Keep secrets out of frontend code. Your server reads secrets as environment variables. Anything bundled into browser JavaScript is public. If a key ended up in client code or was pasted into chat, rotate it at the provider. To search a built bundle for keys, see the security checklist for vibe-coded apps. Rotation steps are in our guide to a leaked API key.

Step 4: Ports and 0.0.0.0, the classic “Preview is blank” and “won’t deploy”

Replit runs your app in a cloud sandbox, so ports behave differently than on your laptop. Three checks from Replit’s ports documentation and the troubleshooting page cover the port failures they describe.

Rule 1: bind to 0.0.0.0, not localhost

The troubleshooting page says a published app’s server must bind to 0.0.0.0; binding only to 127.0.0.1 (localhost) fails. According to the ports page, most frameworks stick to localhost while you develop, for privacy and security, so set the host yourself:

// Express
const port = Number(process.env.PORT) || 3000;
app.listen(port, "0.0.0.0", () => console.log(`listening on ${port}`));
# Flask
app.run(host="0.0.0.0", port=5000)
# Vite dev server
vite --host 0.0.0.0 --port 5173

Reading process.env.PORT with a fallback keeps code portable between hosts. On Replit, what matters is that the port your code listens on matches your .replit config (below).

Rule 2: the port in .replit must match the port your code uses

Replit maps an external port to the internal port your program listens on. The mapping is stored under [[ports]] in your .replit file:

[[ports]]
localPort = 3000
externalPort = 80

To see it in the editor, the ports page says to select + in the tab bar, search for Networking, pick the Developer result and open Networking. The Ports table there lists internal and external ports.

What to check:

  • Code and config disagree. The config says 3000, but the code (or Agent’s latest edit) moved to 8080. Traffic arrives at a port nothing is listening on. Framework defaults differ: the ports page lists 5000 for Flask, 3000 for React and 8000 for Laravel.
  • More than one exposed port. Autoscale and Reserved VM accept a single external port, and that port can’t be bound to localhost. Expose more, or a localhost-only port, and the published app fails. Remove every externalPort except the one for your web server.
  • No port 80. Once your .replit file lists any ports, automatic port detection is off. The troubleshooting page says you then need your server’s localPort mapped to externalPort = 80 for the promote step to pass.

Rule 3: respond within five seconds

This is the health check from the Publish error section: Replit requests your homepage before going live, and anything slower than five seconds risks a failed publish.

Step 5: Development vs production database

Replit’s built-in Database is managed PostgreSQL, and each Replit App uses two databases: a development database that you and Agent build with, and a production database that serves the published app, created when you publish. Agent can read production through a read-only replica but can’t change it.

Data missing after publishing

Empty tables in the live app don’t mean the data is gone. Check these in turn:

  • You’re looking at the other database. The published app reads production, while the editor, Shell and Agent use development. Both read a variable named DATABASE_URL, with a different value in each environment. To see live data, open the Database tool, pick Production from the database menu and open My Data. Production opens read-only.
  • Your test data may not have gone across. On Replit’s current database infrastructure, the development and production page says a production database is created on publish when development has data. Legacy (Neon-hosted) development databases create it from Database settings while publishing, with a separate switch to copy development data over. Replit’s database troubleshooting page is clear that publishing your code doesn’t prove development records were copied.
  • Your app points at another database. A DATABASE_URL you added to Secrets yourself, or a variable such as SUPABASE_DATABASE_URL, can mean the app talks to an external database the Database tool doesn’t show. The development and production page includes an Agent prompt that checks this without revealing secret values.
  • A recent schema change renamed or dropped something. See migrations below.

While you investigate, don’t reset the database, drop tables, or overwrite production with development data. The troubleshooting page rules out all three as diagnostic steps.

Migrations on publish

Agent changes the development schema, and Replit applies the difference to production when you publish. Replit’s page on how publishing updates the production database walks through the flow:

  • Renamed or new column? If a column disappeared and another appeared, Replit asks whether it was renamed. Answering No, create new column for a real rename drops the old column and its data. If you’re unsure, cancel and ask Agent what changed.
  • Read the generated SQL. An orange data-loss warning lists affected tables with row counts, but only tables that hold production rows, so dropping an empty table triggers no warning at all.
  • Only the public schema is compared. Tables in a custom schema can be missing from production while publishing reports no changes.
  • Not everything is copied. Functions, procedures, triggers, domains and grants aren’t migrated, and roles have limited support. If a table or policy depends on a function or role that isn’t in production, the migration stops with a “does not exist” error and Replit rolls it back. A missing trigger or grant doesn’t stop the publish, but the app can behave differently from Preview.
  • No schema changes in startup code. Replit says the build command and server entrypoint shouldn’t change the schema (no db:push, drizzle-kit push or create-table-if-missing statements), because those would run on every publish and skip the review.
  • Test first if it’s risky. After validation, Create preview deploy builds the app on a migrated copy of the production data. The preview lasts two hours.

Platform incidents can look like database bugs too. From Sep 1 to Sep 4, 2026 (Pacific time), Replit’s status page tracked some projects failing to publish with a DATABASE_URL error. Replit said production data was confirmed safe and asked anyone with missing development data, columns that seem to have vanished, or a migration holding an unusually large number of drop statements to contact support. If your symptoms match an open incident, wait for it instead of approving a migration.

If data really is gone, Replit’s data recovery docs list point-in-time restores of the production database (7 days by default, up to 28 on Pro, Teams and Enterprise) and checkpoint rollbacks for development. Our guide on recovering a database an AI agent deleted covers restoring without overwriting newer data.

Connection errors

The development and production page says production databases have no connection pooling by default, so let your framework or ORM keep one shared pool rather than opening a connection per request. If failures happen only in production, check Step 3 as well: a missing secret looks a lot like a database problem. If the production connection string leaked, the same page links to steps for issuing new credentials. Do that, then update anything that used the old string.

For files (images, uploads, documents), use App Storage, not the app’s filesystem.

Step 6: The Agent loop: “the AI keeps re-fixing it”

You ask Agent to fix an error, it fixes something else, the original error comes back, and the credits keep going.

  • Stop it. Replit’s Agent help says to press Stop in the chat, run Restart compute, then open a new chat and restate the task more specifically. It also suggests asking for a plan and approving it before Agent builds, and setting a spending limit to cap what a loop can cost.
  • Roll back instead of untangling. Replit’s guide to building with Agent recommends a checkpoint when the app got worse, important behaviour broke, or more changed than you expected. The pages describe the controls differently: that guide puts checkpoints under History in the chat and labels the button Rollback here, while the checkpoints and rollbacks page describes the Agent tab and Rollback to here.
  • Know what a rollback touches. Checkpoints capture project files, Agent’s memory of the conversation and, optionally, database contents. By default a rollback leaves the database alone. To include the development database, tick Database in the rollback’s additional options. The production database isn’t restored by a rollback.
  • Give it evidence, not adjectives. “It’s broken” invites guessing. The exact log line, what you expected and what you already tried give Agent something to work with.

Agent stuck on ‘working’ or thinking

When Agent sits on “working” or thinking and nothing changes, go through these in order:

  1. Check the status page first. Agent problems show up on status.replit.com. The Nov 24–25 Agent chat incident above is one example, and a Dec 1, 2026 entry titled “Resolved: Anthropic Models Facing Issues” lists Replit Agent as impacted. If something is listed, wait for it to clear rather than sending more messages.
  2. Stop sending messages. Replit’s Agent help says extra messages while Agent looks frozen give it conflicting instructions.
  3. Restart compute. Run Restart compute from the command palette (Cmd+K or Ctrl+K).
  4. Make the task smaller. If Agent freezes on the same task again, the help page suggests splitting it into smaller, focused prompts. One goal per message.
  5. Roll back if the last run left things half-done. Use a checkpoint from before the stuck task (see Step 6 for where the controls are).
  6. Start a fresh chat with the exact error. Open a new Agent chat and describe the task again, pasting the exact error or log line rather than a summary.

If you’d rather undo Agent’s work by hand, or you exported the project to an editor, the Cursor, Windsurf and git undo guide walks through git restore, revert and reflog.

A quick “it’s live” checklist

Replit’s troubleshooting page closes with its own finish line. Based on it, check that:

  • The app runs in Preview.
  • The publish finishes without errors.
  • The replit.app address (or your domain) opens.
  • The main user journey works on the public address, not only in Preview.
  • Production secrets and settings are in place.
  • The logs show no errors during startup.

Then test like a stranger: open the public URL in a private window, sign up as a new user and try the main action end to end. If you’re weighing a move to another host, the Replit and Base44 exit guide lists what to take with you.

FAQ

How do I fix my Replit app?

Work from the outside in. Check status.replit.com for an incident, confirm the app runs in Preview, then compare the published app with the editor: deployment type, production secrets, the 0.0.0.0 host and .replit port mapping, and which database it reads. The publishing logs show where a failed publish stopped.

Why is the Replit Agent stuck on working?

First rule out an incident on Replit’s status page. If there isn’t one, stop sending messages, run Restart compute from the command palette, and start a new Agent chat with a smaller task and the exact error. If the stuck run changed files, roll back to the checkpoint from before it.

Why is my published Replit app’s database empty?

The published app reads its production database, and the editor shows the development one. Open the Database tool and switch to Production to check. Publishing your code doesn’t show that development records were copied over, and an extra DATABASE_URL in Secrets can send the app to a different database.

Why does my Replit app work in Preview but not when published?

Compare the two environments. Check that every secret exists in the Publishing pane’s production secrets, that the deployment type isn’t Static for an app with a backend, that the server binds to 0.0.0.0 on the port mapped to externalPort = 80, and that the app isn’t relying on files saved to disk.

Why did my Replit publish fail?

Open the failed deployment’s logs and find the first error. Causes to check include a wrong run or build command, a security scan blocking critical vulnerabilities, a homepage that takes longer than five seconds to answer the health check, a database migration that failed validation, and a platform incident on the status page.

Comments

Add a comment

Generated for you. Click to type your own.

Required. Never shown on the page. Privacy policy.

Basic markdown: **bold**, *italic*, `code`, lists, quotes, and fenced code blocks. HTML shows as plain text.

Your draft stays on this device until you post.