paperclipai/paperclip · error

Unable to allocate a Fetch-allowed Smoke Lab fixture port

Error message

Unable to allocate a Fetch-allowed Smoke Lab fixture port

What it means

Resource-exhaustion guard in allocateFetchAllowedLoopbackPort: repeatedly binding an ephemeral 127.0.0.1 port and closing it failed to yield a port the Fetch guard classifies as allowed. Indicates host network stack trouble; the loopback/port allocation environment is at fault.

Source

Thrown at server/src/services/smoke-lab.ts:88

    const server = createNetServer();
    const port = await new Promise<number>((resolve, reject) => {
      const onError = (error: Error) => {
        server.off("error", onError);
        reject(error);
      };
      server.once("error", onError);
      server.listen(0, "127.0.0.1", () => {
        server.off("error", onError);
        const address = server.address();
        resolve(typeof address === "object" && address ? address.port : 0);
      });
    });
    await new Promise<void>((resolve, reject) => {
      server.close((error) => error ? reject(error) : resolve());
    });
    if (port > 0 && !FETCH_BLOCKED_PORTS.has(port)) return port;
  }
  throw new Error("Unable to allocate a Fetch-allowed Smoke Lab fixture port");
}

const HTTP_APP_KEY = "paperclip.smoke-lab.http-fixture";
const STDIO_APP_KEY = "paperclip.smoke-lab.stdio-fixture";
const HTTP_CONNECTION_NAME = "Smoke Lab HTTP MCP fixture";
const STDIO_CONNECTION_NAME = "Smoke Lab stdio MCP fixture";
const STDIO_TEMPLATE_KEY = "paperclip.smoke-lab.stdio-fixture";
const PROFILE_KEY = "paperclip.smoke-lab.profile";
const HTTP_SERVICE_ID = "http-mcp-fixture" as const;
const OAUTH_SERVICE_ID = "fake-oauth" as const;

function smokeFixtureToken(prefix: "code" | "access" | "refresh", parts: Record<string, string>) {
  const stableInput = Object.keys(parts)
    .sort()
    .map((key) => `${key}=${parts[key]}`)
    .join("\n");
  return `smoke_${prefix}_${createHash("sha256").update(stableInput).digest("hex").slice(0, 24)}`;
}

View on GitHub (pinned to 120ae5428f)

Solutions

  1. Free up ports in the Smoke Lab fixture range or widen the allowed port range; all candidate ports are currently excluded or in use.
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at server/src/services/smoke-lab.ts:88 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of paperclipai/paperclip@120ae5428f (2026-08-18). Data as JSON: /api/errors/ea573e3686655bae. Report an issue: GitHub.