{"record":{"id":"95371b34fa962322","repo":"musistudio/claude-code-router","slug":"invalid-url-rawurl","errorCode":null,"errorMessage":"Invalid URL \"${rawUrl}\".","messagePattern":"Invalid URL \"(.+?)\"\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/src/routing/route-script-worker.ts","lineNumber":301,"sourceCode":"}\n\nfunction resolveScriptPath(file: string): string {\n  if (typeof file !== \"string\" || !file.trim() || file.includes(\"\\0\")) {\n    throw new Error(\"A valid filesystem path is required.\");\n  }\n  if (file === \"~\") return path.resolve(os.homedir());\n  if (file.startsWith(\"~/\") || file.startsWith(\"~\\\\\")) {\n    return path.resolve(os.homedir(), file.slice(2));\n  }\n  return path.resolve(file);\n}\n\nfunction assertHttpUrl(rawUrl: string): void {\n  let url: URL;\n  try {\n    url = new URL(rawUrl);\n  } catch {\n    throw new Error(`Invalid URL \"${rawUrl}\".`);\n  }\n  if ((url.protocol !== \"http:\" && url.protocol !== \"https:\") || url.username || url.password || !url.hostname) {\n    throw new Error(\"Only HTTP(S) URLs without embedded credentials are supported.\");\n  }\n}\n\nfunction serializeResult(value: unknown): unknown {\n  if (value === undefined) return undefined;\n  const encoded = JSON.stringify(value);\n  if (encoded === undefined) throw new Error(\"Script result must be JSON serializable.\");\n  if (Buffer.byteLength(encoded, \"utf8\") > maxResultBytes) {\n    throw new Error(`Script result exceeds ${maxResultBytes} bytes.`);\n  }\n  return JSON.parse(encoded);\n}\n\nasync function withDeadline<T>(promise: Promise<T>, deadline: number): Promise<T> {\n  const remainingMs = Math.max(1, deadline - Date.now());","sourceCodeStart":283,"sourceCodeEnd":319,"githubUrl":"https://github.com/musistudio/claude-code-router/blob/99f24806c6a2c660b16e53e95211c517448a6c90/packages/core/src/routing/route-script-worker.ts#L283-L319","documentation":"Error \"Invalid URL \"${rawUrl}\".\" thrown in musistudio/claude-code-router.","triggerScenarios":"Thrown at packages/core/src/routing/route-script-worker.ts:301 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"99f24806c6a2c660b16e53e95211c517448a6c90","analyzedAt":"2026-08-27T04:11:01.184Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}