musistudio/claude-code-router · error · Error

Invalid URL "${rawUrl}".

Error message

Invalid URL "${rawUrl}".

What it means

Error "Invalid URL "${rawUrl}"." thrown in musistudio/claude-code-router.

Source

Thrown at packages/core/src/routing/route-script-worker.ts:301

}

function resolveScriptPath(file: string): string {
  if (typeof file !== "string" || !file.trim() || file.includes("\0")) {
    throw new Error("A valid filesystem path is required.");
  }
  if (file === "~") return path.resolve(os.homedir());
  if (file.startsWith("~/") || file.startsWith("~\\")) {
    return path.resolve(os.homedir(), file.slice(2));
  }
  return path.resolve(file);
}

function assertHttpUrl(rawUrl: string): void {
  let url: URL;
  try {
    url = new URL(rawUrl);
  } catch {
    throw new Error(`Invalid URL "${rawUrl}".`);
  }
  if ((url.protocol !== "http:" && url.protocol !== "https:") || url.username || url.password || !url.hostname) {
    throw new Error("Only HTTP(S) URLs without embedded credentials are supported.");
  }
}

function serializeResult(value: unknown): unknown {
  if (value === undefined) return undefined;
  const encoded = JSON.stringify(value);
  if (encoded === undefined) throw new Error("Script result must be JSON serializable.");
  if (Buffer.byteLength(encoded, "utf8") > maxResultBytes) {
    throw new Error(`Script result exceeds ${maxResultBytes} bytes.`);
  }
  return JSON.parse(encoded);
}

async function withDeadline<T>(promise: Promise<T>, deadline: number): Promise<T> {
  const remainingMs = Math.max(1, deadline - Date.now());

View on GitHub (pinned to 99f24806c6)

When it happens

Trigger: Thrown at packages/core/src/routing/route-script-worker.ts:301 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of musistudio/claude-code-router@99f24806c6 (2026-08-27). Data as JSON: /api/errors/95371b34fa962322. Report an issue: GitHub.