{"record":{"id":"4b8273ab6383a564","repo":"musistudio/claude-code-router","slug":"plugin-module-must-export-a-function-default-plug","errorCode":null,"errorMessage":"Plugin module must export a function, default plugin, or plugin object.","messagePattern":"Plugin module must export a function, default plugin, or plugin object\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/core/src/plugins/service.ts","lineNumber":1007,"sourceCode":"function isProtocolSpecifier(value: string): boolean {\n  return /^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(value);\n}\n\nfunction isPathInside(file: string, root: string): boolean {\n  const relative = path.relative(root, file);\n  return relative === \"\" || (Boolean(relative) && !relative.startsWith(\"..\") && !path.isAbsolute(relative));\n}\n\nfunction normalizeLoadedPlugin(moduleValue: unknown): LoadedPlugin {\n  const record = isRecord(moduleValue) ? moduleValue : {};\n  const candidate = record.default ?? record.plugin ?? moduleValue;\n  if (typeof candidate === \"function\") {\n    return { setup: candidate as LoadedPlugin[\"setup\"] };\n  }\n  if (isRecord(candidate)) {\n    return candidate as LoadedPlugin;\n  }\n  throw new Error(\"Plugin module must export a function, default plugin, or plugin object.\");\n}\n\nfunction matchProxyRoute(route: RegisteredProxyRoute, targetUrl: URL): string | undefined {\n  if (!matchesHost(route.host, targetUrl.hostname)) {\n    return undefined;\n  }\n  if (!route.paths?.length) {\n    return \"\";\n  }\n  let matchedPathPrefix: string | undefined;\n  for (const pathPrefix of route.paths) {\n    const normalizedPathPrefix = normalizeRoutePath(pathPrefix) ?? \"/\";\n    if (!matchesPathPrefix(normalizedPathPrefix, targetUrl.pathname)) {\n      continue;\n    }\n    if (!matchedPathPrefix || normalizedPathPrefix.length > matchedPathPrefix.length) {\n      matchedPathPrefix = normalizedPathPrefix;\n    }","sourceCodeStart":989,"sourceCodeEnd":1025,"githubUrl":"https://github.com/musistudio/claude-code-router/blob/99f24806c6a2c660b16e53e95211c517448a6c90/packages/core/src/plugins/service.ts#L989-L1025","documentation":"Error \"Plugin module must export a function, default plugin, or plugin object.\" thrown in musistudio/claude-code-router.","triggerScenarios":"Thrown at packages/core/src/plugins/service.ts:1007 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"}