symfony/var-dumper · error · RuntimeException
Server start failed on
Error message
Server start failed on "%s":
What it means
DumpServer::start() opens a stream_socket_server on the configured host (e.g. tcp://127.0.0.1:9912). If the socket cannot be created — port already in use, permission denied, bad address — a RuntimeException is thrown appending the OS error string and errno.
Solutions
- Kill the process already bound to the port (lsof -i :9912 / netstat) or stop the duplicate server:dump run
- Choose a free port (e.g. --port=9913) and update your client VAR_DUMPER_SERVER accordingly
- Verify the host string format is tcp://host:port with a port in 1-65535
Example fix
// before
$server->start('tcp://127.0.0.1:9912'); // in use
// after
$server->start('tcp://127.0.0.1:9913'); Defensive patterns
Strategy: retry
Validate before calling
$parts = parse_url($host);
if (!$parts || !isset($parts['port']) || $parts['port'] < 1 || $parts['port'] > 65535) {
throw new \InvalidArgumentException('Dump server host must be tcp://host:port with a valid port');
}
$conn = @fsockopen($parts['host'] ?? '127.0.0.1', $parts['port'], $errno, $errstr, 1);
if (is_resource($conn)) {
fclose($conn);
throw new \RuntimeException("Port {$parts['port']} already in use");
} Type guard
function isBindableAddress(string $host): bool {
return (bool) preg_match('#^tcp:\/\/[\w.\-]+:\d{1,5}$#', $host);
} Try / catch
try {
$server->start();
} catch (\RuntimeException $e) {
if (str_contains($e->getMessage(), 'Server start failed')) {
// check port in use / pick alternate port, or surface the OS errno
} else {
throw $e;
}
} Prevention
- Check the port is free before starting (lsof/netstat or fsockopen probe)
- Use ports above 1024 to avoid permission-denied binds
- Keep host strings in tcp://host:port form and sync client VAR_DUMPER_SERVER with the chosen port
- Stop stale server:dump processes from previous dev sessions
When it happens
Trigger: Another process (including a second server:dump instance) already listens on the port; port below 1024 without root; invalid host string like tcp://localhost:99999; firewall blocking bind.
Common situations: Leftover dump server from a previous run still holding the port in dev; Docker/WSL port conflicts; typo'd host/port in dump config or VAR_DUMPER_SERVER env vars.
AI-assisted analysis of symfony/var-dumper@e9d9cf5dcd (2026-09-14).
Data as JSON: /api/errors/1246ab6569078d29.
Report an issue: GitHub.
Appendix: source
Thrown at Server/DumpServer.php:49
* @var resource|null
*/
private $socket;
public function __construct(
string $host,
private ?LoggerInterface $logger = null,
) {
if (!str_contains($host, '://')) {
$host = 'tcp://'.$host;
}
$this->host = $host;
}
public function start(): void
{
if (!$this->socket = stream_socket_server($this->host, $errno, $errstr)) {
throw new \RuntimeException(\sprintf('Server start failed on "%s": ', $this->host).$errstr.' '.$errno);
}
}
/**
* @param-immediately-invoked-callable $callback
*/
public function listen(callable $callback): void
{
if (null === $this->socket) {
$this->start();
}
foreach ($this->getMessages() as $clientId => $message) {
$this->logger?->info('Received a payload from client {clientId}', ['clientId' => $clientId]);
$payload = @unserialize(base64_decode($message), ['allowed_classes' => [Data::class, Stub::class, ClassDumpStub::class]]);
// Impossible to decode the message, give up.View on GitHub (pinned to e9d9cf5dcd)