Skip to main content

inspector port is used

FATA[12:00:00] Failed to start Traffic Inspector: inspector port 4100 is used by tuna http (pid 81234, https://myapp.a.2na.am). Set another --inspect-port or unset TUNA_INSPECT_PORT

If the port is held by something other than tuna:

FATA[12:00:00] Failed to start Traffic Inspector: inspector port 4100 is not available: listen tcp 127.0.0.1:4100: bind: address already in use. Set another --inspect-port or unset TUNA_INSPECT_PORT

tuna CLI prints this error when starting a tunnel with the inspector. The tunnel doesn't start.

Causeโ€‹

The inspector port is set explicitly โ€” with the --inspect-port flag or the TUNA_INSPECT_PORT variable โ€” and it's taken by another tuna tunnel or another program. With an explicit port, tuna doesn't look for a free one; it exits so that the inspector address doesn't change without you noticing.

Without an explicit port, there's no error: the first tunnel takes 4040, the next ones 4041, 4042, and so on, see Startup and port.

If the port is set incorrectly, the message is different:

  • invalid TUNA_INSPECT_PORT "abc" โ€” the variable isn't a number;
  • port 70000 is out of range 1-65535 โ€” the port is outside the valid range;
  • failed to parse TUNA_INSPECT_ADDR: invalid port "abc" โ€” the port in TUNA_INSPECT_ADDR is invalid.

What to doโ€‹

  1. If another tuna tunnel holds the port, the message names its command, PID, and address. Stop it or pick another port.
  2. Set a free port: tuna http 8080 --inspect-port=4101.
  3. If the port doesn't matter, remove --inspect-port and the TUNA_INSPECT_PORT variable โ€” tuna will pick a free one itself.
  4. If you run several tunnels with tuna start, give each its own port, see Several tunnels.