musistudio/claude-code-router · error
Plugin module must export a function, default plugin, or plu
Error message
Plugin module must export a function, default plugin, or plugin object.
What it means
Error "Plugin module must export a function, default plugin, or plugin object." thrown in musistudio/claude-code-router.
Source
Thrown at packages/core/src/plugins/service.ts:1007
function isProtocolSpecifier(value: string): boolean {
return /^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(value);
}
function isPathInside(file: string, root: string): boolean {
const relative = path.relative(root, file);
return relative === "" || (Boolean(relative) && !relative.startsWith("..") && !path.isAbsolute(relative));
}
function normalizeLoadedPlugin(moduleValue: unknown): LoadedPlugin {
const record = isRecord(moduleValue) ? moduleValue : {};
const candidate = record.default ?? record.plugin ?? moduleValue;
if (typeof candidate === "function") {
return { setup: candidate as LoadedPlugin["setup"] };
}
if (isRecord(candidate)) {
return candidate as LoadedPlugin;
}
throw new Error("Plugin module must export a function, default plugin, or plugin object.");
}
function matchProxyRoute(route: RegisteredProxyRoute, targetUrl: URL): string | undefined {
if (!matchesHost(route.host, targetUrl.hostname)) {
return undefined;
}
if (!route.paths?.length) {
return "";
}
let matchedPathPrefix: string | undefined;
for (const pathPrefix of route.paths) {
const normalizedPathPrefix = normalizeRoutePath(pathPrefix) ?? "/";
if (!matchesPathPrefix(normalizedPathPrefix, targetUrl.pathname)) {
continue;
}
if (!matchedPathPrefix || normalizedPathPrefix.length > matchedPathPrefix.length) {
matchedPathPrefix = normalizedPathPrefix;
}View on GitHub (pinned to 99f24806c6)
When it happens
Trigger: Thrown at packages/core/src/plugins/service.ts:1007 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/4b8273ab6383a564.
Report an issue: GitHub.