Chii Remote Debugging Tool Fails to Start Due to Path Regex Parsing Error

When attempting to start the server with chii start -p 3000, users encounter a runtime error originating from the path-to-regexp library:

TypeError: Unexpected MODIFIER at 11, expected END
    at mustConsume (path-to-regexp/dist/index.js:113:15)
    at parse (path-to-regexp/dist/index.js:189:9)
    ...
    at new Layer (koa-router/lib/layer.js:44:19)
    at Router.register (koa-router/lib/router.js:471:19)
    at Router.get (koa-router/lib/router.js:814:10)
    at createStatic (chii/server/middle/router.js:67:12)

This error occurs because koa-router is receiving an invalid route pattern — specifically, a route string containing an unescaped or malformed modifier (e.g., /* or :param?) that the newer version of path-to-regexp (v7+) strictly validates. The issue stems from a hardcoded route definition in Chii’s router configuration that is incompatible with the updated regex parser.

The fix has been proposed in a GitHub pull request, but as of now, it remains unmerged. To resolve this manually, locate your global Chii installation:

  • pnpm: C:\Users\{username}\AppData\Local\pnpm\global\5\.pnpm\chii@1.15.4\node_modules\chii\server\middle\router.js
  • bun: C:\Users\{username}\.bun\install\global\node_modules\chii\server\middle\router.js

Open router.js and find line 67, which likely contains:

app.use(router.get('/static/*', createStatic()));

Modify it to use a valid, escaped wildcard pattern:

app.use(router.get('/static/*(.*)', createStatic()));

Alternatively, replace the wildcard with a more explicit route if static asset serving is not critical:

app.use(router.get('/static/:path*', createStatic()));

Save the file and restart the server. The error should now be resolved.

Once the server runs, inject the debugging script into your target page:

<script src="http://your-local-ip:3000/target.js"></script>

Ensure the IP address matches the machine runing Chii (not localhost if debugging from a mobile device). The script connects back to the Chii server, enabling DOM inspection and console logging remotely.

However, known limitations persist:

  • Injected scripts may fail to load due to CORS or HTTPS restrictions when using reverse proxies like frp or ngrok.
  • Element selection (inspector tool) often fails because the debugging UI and target page run on seperate origins.
  • Changes made in the Chii interface do not auto-refresh the target page.

Alternative tools like Chrome’s chrome://inspect/#devices offer superior integration: live CSS editing, real-time DOM updates, and direct device detection without script injection. For Android, Kiwi Browser provides built-in DevTools, eliminating the need for external tools.

While Chii was useful in the past, its last release was in 2024, and the project appears unmaintained. Modern alternatives such as Chrome Remote Debugging or Vite’s built-in mobile preview offer more reliable, secure, and feature-complete workflows.

Tags: chii koa-router path-to-regexp remote-debugging mobile-web

Posted on Fri, 18 Sep 2026 16:59:04 +0000 by Harbinger