moeru-ai/airi · error · Error

Unsupported route path "${routePath}". Route paths must star

Error message

Unsupported route path "${routePath}". Route paths must start with "/".

What it means

Thrown by the capture script's argument validation when the route path does not start with a forward slash. The script navigates the running app to the given route via a router that requires absolute paths, so a relative or malformed route string is rejected before capture begins.

Source

Thrown at packages/scenarios-stage-tamagotchi-browser/scripts/capture.ts:63

    speed: avifSpeed,
  })

  await writeFile(derivedFilePath, avifBuffer)
  await rm(artifact.filePath, { force: true })

  return {
    ...artifact,
    filePath: derivedFilePath,
    format: 'avif',
  }
}

if (!['png', 'avif'].includes(requestedFormat)) {
  throw new Error(`Unsupported capture format "${requestedFormat}". Expected "png" or "avif".`)
}

if (!routePath?.startsWith('/')) {
  throw new Error(`Unsupported route path "${routePath}". Route paths must start with "/".`)
}

if (outputDirFlagIndex >= 0 && !argv[outputDirFlagIndex + 1]) {
  throw new Error('Missing value for --output-dir.')
}

if (settleMsFlagIndex >= 0 && !argv[settleMsFlagIndex + 1]) {
  throw new Error('Missing value for --settle-ms.')
}

if (avifMaxWidthFlagIndex >= 0 && !argv[avifMaxWidthFlagIndex + 1]) {
  throw new Error('Missing value for --avif-max-width.')
}

if (avifQualityFlagIndex >= 0 && !argv[avifQualityFlagIndex + 1]) {
  throw new Error('Missing value for --avif-quality.')
}

View on GitHub (pinned to 27111382b4)

Solutions

  1. Prefix the route with `/` so it is an absolute path (e.g. `/settings`, `/devtools/...`).
  2. In wrapper scripts, normalize the route with `route.startsWith('/') ? route : '/' + route` before passing it in.
  3. If using a hash-based URL, extract the path portion and ensure it begins with `/`.
  4. Confirm the route exists in the app's router config before capturing.

Example fix

// before
node scripts/capture.ts --route settings

// after
node scripts/capture.ts --route /settings
Defensive patterns

Strategy: validation

Validate before calling

function normalizeRoute(route: string): string {
  return route.startsWith('/') ? route : `/${route}`
}
if (!normalizeRoute(routePath).startsWith('/')) {
  throw new Error(`Invalid route path: ${routePath}`)
}

Type guard

function isAbsoluteRoute(route: string): boolean {
  return route.startsWith('/')
}

Prevention

When it happens

Trigger: Passing a route argument like `settings`, `#/chat`, or `chat/` (missing leading `/`) to the capture script. Also triggered by routes built from joined segments that drop the leading slash, or by copying a fragment-only URL.

Common situations: Contributors passing a bare page name instead of the route path; wrapper scripts that join segments without ensuring a leading `/`; copied URLs that include only the hash portion.

Related errors


AI-assisted analysis of moeru-ai/airi@27111382b4 (2026-08-12). Data as JSON: /api/errors/e701cd12714972c0. Report an issue: GitHub.