paperclipai/paperclip · error

API route not found

Error message

API route not found

What it means

API catch-all in createApp: the request matched the /api mount but no registered route handled its method+path, so Express fell through to the terminal middleware which returns a uniform 404 JSON error. It is a router fallback, not a thrown exception.

Solutions

  1. Check the request path and method against the API routes; correct the URL and retry.
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at server/src/app.ts:661 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of paperclipai/paperclip@3f1d897a7c (2026-09-18). Data as JSON: /api/errors/0f4419bb26e2e4e4. Report an issue: GitHub.

Appendix: source

Thrown at server/src/app.ts:939

  api.use(
    adapterRoutes({
      getNativeRunnerEnabled: async () =>
        (await instanceSettingsService(db).getExperimental())
          .enableNativeRunner === true,
    }),
  );
  api.use(
    accessRoutes(db, {
      deploymentMode: opts.deploymentMode,
      deploymentExposure: opts.deploymentExposure,
      bindHost: opts.bindHost,
      allowedHostnames: opts.allowedHostnames,
      authPublicBaseUrl: opts.authPublicBaseUrl,
    }),
  );
  app.use("/api", api);
  app.use("/api", (_req, res) => {
    res.status(404).json({ error: "API route not found" });
  });
  app.use(
    pluginUiStaticRoutes(db, {
      localPluginDir: opts.localPluginDir ?? DEFAULT_LOCAL_PLUGIN_DIR,
    }),
  );

  const __dirname = path.dirname(fileURLToPath(import.meta.url));
  if (opts.uiMode === "static") {
    // Try published location first (server/ui-dist/), then monorepo dev location (../../ui/dist)
    const candidates = [
      path.resolve(__dirname, "../ui-dist"),
      path.resolve(__dirname, "../../ui/dist"),
    ];
    const uiDist = candidates.find((p) =>
      fs.existsSync(path.join(p, "index.html")),
    );
    if (uiDist) {

View on GitHub (pinned to 3f1d897a7c)