musistudio/claude-code-router · error · Error
New API account connector requires CCR Desktop browser accou
Error message
New API account connector requires CCR Desktop browser account fetch support.
What it means
resolveSubscriptionSelf requires request.fetchProviderAccountJson to be a function — a browser-account fetch helper injected by CCR Desktop. If the host does not provide it (old build, non-Electron caller, direct unit invocation), the connector refuses to proceed.
Source
Thrown at packages/electron/bundled-plugins/new-api-account/index.cjs:24
const DEFAULT_TIMEOUT_MS = 15000;
module.exports = {
setup(ctx) {
ctx.logger?.info?.("new-api account connector registered");
return {
providerAccountConnectors: [
{
id: CONNECTOR_ID,
resolve: resolveSubscriptionSelf
}
]
};
}
};
async function resolveSubscriptionSelf(request) {
if (typeof request.fetchProviderAccountJson !== "function") {
throw new Error("New API account connector requires CCR Desktop browser account fetch support.");
}
const options = isRecord(request.connector?.options) ? request.connector.options : {};
const root = newApiRootBaseUrl(readString(options.baseUrl) || providerBaseUrl(request.provider));
if (!root) {
throw new Error("New API provider base URL is missing.");
}
const timeoutMs = normalizeTimeoutMs(options.timeoutMs);
const requestOrigin = readString(options.requestOrigin) || root;
const refreshPayload = await request.fetchProviderAccountJson({
body: options.refreshBody ?? {},
credentials: "include",
endpoint: rootUrl(root, readString(options.refreshPath) || DEFAULT_REFRESH_PATH),
headers: readStringRecord(options.refreshHeaders),
method: "POST",
requestOrigin,
timeoutMsView on GitHub (pinned to 99f24806c6)
Solutions
- Update CCR Desktop to a build that injects fetchProviderAccountJson
- If calling programmatically, pass a request object implementing fetchProviderAccountJson({ endpoint, credentials, headers, body, timeoutMs })
- Verify the plugin version matches the host bridge version
Example fix
// before
await connector.resolveSubscriptionSelf({ connector, provider }); // missing helper
// after
await connector.resolveSubscriptionSelf({
connector,
provider,
fetchProviderAccountJson: async ({ endpoint, init }) => fetch(endpoint, init).then(r => r.json()),
}); Defensive patterns
Strategy: type-guard
Validate before calling
if (typeof request?.fetchProviderAccountJson !== 'function') {
throw new Error('Host does not support browser account fetching; update CCR Desktop.');
} Type guard
function hasBrowserFetch(request: unknown): request is { fetchProviderAccountJson: (init: any) => Promise<any> } {
return typeof (request as any)?.fetchProviderAccountJson === 'function';
} Try / catch
null
Prevention
- Version-check the host bridge before loading the connector
- Provide a fetchProviderAccountJson shim in tests
- Fail fast on capability detection at connector init
When it happens
Trigger: Invoking the new-api-account connector's resolveSubscriptionSelf outside CCR Desktop, in an older Desktop build that predates fetchProviderAccountJson, or from tests with a stubbed request object missing the method.
Common situations: Version skew between the bundled plugin and the Desktop host, calling the connector programmatically without the bridge, or refactors that renamed the injected helper.
Related errors
AI-assisted analysis of musistudio/claude-code-router@99f24806c6 (2026-08-27).
Data as JSON: /api/errors/c7f69e99b3a602cb.
Report an issue: GitHub.