earendil-works/pi · error · Error

Unix listener is closing or closed

Error message

Unix listener is closing or closed

What it means

Error "Unix listener is closing or closed" thrown in earendil-works/pi.

Source

Thrown at packages/server/src/transports/unix/listener.ts:62

	private ownedBindPath?: string;
	private boundPath?: string;
	private closing = false;
	private closePromise?: Promise<void>;
	private accept?: ByteConnectionAcceptor;

	constructor(options: UnixListenerOptions) {
		this.options = resolveUnixListenerOptions(options);
		this.path = this.options.path;
		this.mode = this.options.mode;
	}

	get address(): string | undefined {
		return this.boundPath;
	}

	async start(accept: ByteConnectionAcceptor): Promise<void> {
		if (this.server) throw new Error("Unix listener is already started");
		if (this.closing) throw new Error("Unix listener is closing or closed");
		this.accept = accept;

		const ownedBindPath = getOwnedBindPath(this.path);
		validateUnixSocketPath(ownedBindPath, "PiServer private Unix bind path");
		await mkdir(dirname(this.path), { recursive: true, mode: 0o700 });
		await removeStaleSocket(this.path);
		await removeStaleSocket(ownedBindPath);
		this.ownedBindPath = ownedBindPath;
		const server = createServer((socket) => this.acceptSocket(socket));
		server.on("error", (error) => this.reportError(error));
		this.server = server;
		try {
			await new Promise<void>((resolve, reject) => {
				const onError = (error: Error): void => {
					server.off("listening", onListening);
					reject(error);
				};
				const onListening = (): void => {

View on GitHub (pinned to 4af9d21d3b)

Solutions

  1. The listener is closing or closed; create a new listener to accept connections.

When it happens

Trigger: Thrown at packages/server/src/transports/unix/listener.ts:62 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of earendil-works/pi@4af9d21d3b (2026-08-24). Data as JSON: /api/errors/d53073778bc322d5. Report an issue: GitHub.