{"record":{"id":"c7f69e99b3a602cb","repo":"musistudio/claude-code-router","slug":"new-api-account-connector-requires-ccr-desktop-bro","errorCode":null,"errorMessage":"New API account connector requires CCR Desktop browser account fetch support.","messagePattern":"New API account connector requires CCR Desktop browser account fetch support\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/electron/bundled-plugins/new-api-account/index.cjs","lineNumber":24,"sourceCode":"const DEFAULT_TIMEOUT_MS = 15000;\n\nmodule.exports = {\n  setup(ctx) {\n    ctx.logger?.info?.(\"new-api account connector registered\");\n    return {\n      providerAccountConnectors: [\n        {\n          id: CONNECTOR_ID,\n          resolve: resolveSubscriptionSelf\n        }\n      ]\n    };\n  }\n};\n\nasync function resolveSubscriptionSelf(request) {\n  if (typeof request.fetchProviderAccountJson !== \"function\") {\n    throw new Error(\"New API account connector requires CCR Desktop browser account fetch support.\");\n  }\n\n  const options = isRecord(request.connector?.options) ? request.connector.options : {};\n  const root = newApiRootBaseUrl(readString(options.baseUrl) || providerBaseUrl(request.provider));\n  if (!root) {\n    throw new Error(\"New API provider base URL is missing.\");\n  }\n\n  const timeoutMs = normalizeTimeoutMs(options.timeoutMs);\n  const requestOrigin = readString(options.requestOrigin) || root;\n  const refreshPayload = await request.fetchProviderAccountJson({\n    body: options.refreshBody ?? {},\n    credentials: \"include\",\n    endpoint: rootUrl(root, readString(options.refreshPath) || DEFAULT_REFRESH_PATH),\n    headers: readStringRecord(options.refreshHeaders),\n    method: \"POST\",\n    requestOrigin,\n    timeoutMs","sourceCodeStart":6,"sourceCodeEnd":42,"githubUrl":"https://github.com/musistudio/claude-code-router/blob/99f24806c6a2c660b16e53e95211c517448a6c90/packages/electron/bundled-plugins/new-api-account/index.cjs#L6-L42","documentation":"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.","triggerScenarios":"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.","commonSituations":"Version skew between the bundled plugin and the Desktop host, calling the connector programmatically without the bridge, or refactors that renamed the injected helper.","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"],"exampleFix":"// before\nawait connector.resolveSubscriptionSelf({ connector, provider }); // missing helper\n\n// after\nawait connector.resolveSubscriptionSelf({\n  connector,\n  provider,\n  fetchProviderAccountJson: async ({ endpoint, init }) => fetch(endpoint, init).then(r => r.json()),\n});","handlingStrategy":"type-guard","validationCode":"if (typeof request?.fetchProviderAccountJson !== 'function') {\n  throw new Error('Host does not support browser account fetching; update CCR Desktop.');\n}","typeGuard":"function hasBrowserFetch(request: unknown): request is { fetchProviderAccountJson: (init: any) => Promise<any> } {\n  return typeof (request as any)?.fetchProviderAccountJson === 'function';\n}","tryCatchPattern":"null","preventionTips":["Version-check the host bridge before loading the connector","Provide a fetchProviderAccountJson shim in tests","Fail fast on capability detection at connector init"],"tags":["dependency-injection","version-skew","browser-bridge"],"backgroundTag":"missing-runtime-capability","analyzedSha":"99f24806c6a2c660b16e53e95211c517448a6c90","analyzedAt":"2026-08-27T04:11:01.184Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}