When firebase emulators:start prints “Port 8080 is not open on localhost, could not start Firestore Emulator” and then “Could not start Firestore Emulator, port taken”, another process is already listening on that emulator’s port, very often a Java process left behind by an earlier emulator run. Find the owner before you change anything: Port Detective from Automata Labs shows which process holds 8080 (or 9099, 9000, 8085, 9199, 5001) on Windows, with its name and PID, plus the full executable path in Port Detective Pro, so you can close the right thing and start the emulators again.
See which process holds your Firebase emulator port before you restart the suite.
Get it fromMicrosoft
What does the error actually mean?
The message comes from the port check in the Firebase CLI (firebase-tools). Before an emulator starts, the CLI tests whether it can listen on the configured host and port. If the port is not free on the primary address and the emulator is not allowed to move, the CLI logs:
Port 8080 is not open on localhost, could not start Firestore Emulator.
To select a different host/port, specify that host/port in a firebase.json config file
Error: Could not start Firestore Emulator, port taken.
The same wording appears for other emulators, with their own port and name: “Authentication Emulator” on 9099, “Database Emulator” on 9000, “Pub/Sub Emulator” on 8085, “Storage Emulator” on 9199 and “Functions Emulator” on 5001. If the host resolves to more than one address, the CLI adds them in brackets, for example localhost (127.0.0.1,::1).
“Not open” here means “not available for the emulator to open”, not that a firewall blocked it.
Which emulators move to another port and which stop?
This is the detail that confuses most people: some emulators quietly pick the next free port, while others refuse to start. In the CLI source, the emulator UI, the hub, the logging emulator, Hosting and App Hosting look for an available port by default. Firestore, Realtime Database, Authentication, Functions, Pub/Sub, Storage and Extensions do not.
| Emulator | Default port (Firebase docs and CLI) | If the port is taken |
|---|---|---|
| Emulator UI | 4000 | Moves to a free port; check the CLI log |
| Emulator hub | 4400 | Moves, with a warning such as “unable to start on port 4400, starting on 4401” |
| Hosting | 5000 | Moves to a free port |
| Cloud Functions | 5001 | Stops with “port taken” |
| Cloud Firestore | 8080 | Stops with “port taken” |
| Pub/Sub | 8085 | Stops with “port taken” |
| Realtime Database | 9000 | Stops with “port taken” |
| Authentication | 9099 | Stops with “port taken” |
| Cloud Storage | 9199 | Stops with “port taken” |
So if your UI ended up on 4001 and Firestore refused to start, both symptoms can come from the same leftover run. Fixed ports are deliberate: your app and tests connect to them by number, so moving silently would point your SDK at nothing.
Why is port 8080 already taken on Windows?
The common causes, roughly in the order worth checking:
- A previous emulator run that did not exit. The Firestore and Realtime Database emulators run as Java processes. If a terminal was closed, VS Code restarted, or a test runner was killed,
java.execan keep listening on 8080 or 9000 after the CLI has gone. - A second project’s emulators. Two repos with default
firebase.jsonsettings both want 8080, 9099 and 9000. - Another tool on 8080. 8080 is a popular default for local web servers, proxies and Java app servers, so something unrelated may own it.
emulators:execstarted whileemulators:startis still running. Both try to start the same emulators on the same ports.- Security software listening on localhost. A GitHub issue on
firebase-toolsdescribes an antivirus web shield holding connections on 8080. Treat this as a rare case and check the owning process rather than disabling protection.
Look up any port and get the owning process, PID and executable path in one step.
Get it fromMicrosoft
How do you find the process with Port Detective?
- Open Port Detective and type the port from the error, such as
8080. - Read the owner. You get the process name, PID and connection state. A
java.exeentry is usually the Firestore or Database emulator; Port Detective Pro also shows the full executable path and parent and child lineage, which tells you whether it came from the Firebase CLI, your IDE or something else. - Decide what to stop. If it is a stale emulator, end it. Port Detective Pro does this in one click and checks a secure process token first, so a recycled PID cannot point the kill at the wrong program.
- Run
firebase emulators:startagain. - Pin the ports you use. Pin 8080, 9099 and 9000 to the dashboard. With Pro, Port Guard can watch them from the tray and notify you when something else grabs one.
The Port Detective guide to ports already in use covers the same workflow for other dev servers.
How do you do it from the command line?
Built-in Windows tools work too. In PowerShell:
Get-NetTCPConnection -LocalPort 8080 -State Listen |
Select-Object LocalAddress, LocalPort, OwningProcess
Get-Process -Id <PID>
Or in Command Prompt:
netstat -ano | findstr :8080
tasklist /FI "PID eq <PID>"
taskkill /PID <PID>
Check the process name before you run taskkill. A PID from netstat can be reused if the original process exits between the two commands; our post on the PID race when killing a process explains why. Many answers online suggest npx kill-port 8080, which ends whatever is listening without telling you what it was. That is fine when you already know it is your own emulator, and risky when it is not; we compare the options in npx kill-port vs portrm vs Port Detective.
When should you change the port in firebase.json instead?
If something else legitimately needs 8080, move the emulator. The Firebase docs show ports set per emulator in firebase.json:
"emulators": {
"firestore": { "port": "8180" },
"auth": { "port": "9099" },
"ui": { "enabled": true, "port": 4001 }
}
You can also run firebase init emulators and accept or change the port prompts; the docs describe it as non-destructive. After a change, point the SDK at the new port, for example connectFirestoreEmulator(db, "127.0.0.1", 8180) in the web SDK, and update any FIRESTORE_EMULATOR_HOST environment variable your server code or tests use. The CLI may also warn when you choose a port that Chrome and other browsers restrict, and it suggests another one.
| Situation | Better fix |
|---|---|
| A stale emulator from your last run | End that process and restart |
| Two Firebase projects at once | Give one project its own ports in firebase.json |
| An unrelated app needs 8080 | Move Firestore to another port |
| It happens every day | Pin the ports and find which tool keeps leaving processes behind |
How do you stop it happening again?
- Stop the emulators with Ctrl+C in the terminal that started them, and wait for “Shutting down emulators” to finish before closing the window.
- If you keep test data with
--export-on-exit, remember the export runs when the emulators shut down, which is one more reason to let them shut down properly. - Keep one emulator session per project, and prefer
emulators:execfor test runs rather than starting a second suite next to a running one. - Check the port owner when the error appears instead of reaching for a blind kill.
Frequently asked questions
Why does the emulator UI start on 4001 but Firestore fails?
The UI, hub, logging and Hosting emulators are allowed to move to a free port, while Firestore and the other data emulators use fixed ports, so they stop with “port taken” instead.
Is “not open” a firewall problem?
Usually not. The CLI means it could not listen on that port because something already is. A firewall affects incoming connections from other machines, not whether a local port can be opened.
Is the java.exe on port 8080 safe to end?
If its path or command line shows the Firebase emulator jar from your own run, yes. If it belongs to another Java app, move the emulator instead.
Does Port Detective work with WSL or Docker?
It shows Windows processes and their ports. Port Detective Pro can also map host ports published by Docker back to the container and image.
Try Port Detective
Get Port Detective (Free) or Port Detective Pro from the Microsoft Store. Free has fewer features than Pro, and Pro offers a free trial on its listing. Both listings require Windows 10 version 17763.0 or higher.
Find the leftover emulator on 8080 and get the Firebase suite running again.
Get it fromMicrosoft
Port Detective is a product of Automata Labs. Firebase, Cloud Firestore and Chrome are trademarks of Google LLC. Java is a trademark of Oracle and/or its affiliates. Windows and PowerShell are trademarks of the Microsoft group of companies.
Last updated 27 November 2026. Published by Automata Labs, a software company in Canada.