{"record":{"id":"ca8e74a21a8fec99","repo":"musistudio/claude-code-router","slug":"claude-design-profiles-can-only-be-opened-from-ccr","errorCode":null,"errorMessage":"Claude Design profiles can only be opened from CCR Desktop.","messagePattern":"Claude Design profiles can only be opened from CCR Desktop\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/cli/src/cli.ts","lineNumber":125,"sourceCode":"\n  const profileOptions = options as ProfileCliOptions;\n  if (profileOptions.help || !profileOptions.profileRef) {\n    printHelp(profileOptions.help ? 0 : 2);\n    return;\n  }\n\n  const configDir = CONFIGDIR;\n  const config = await loadAppConfig();\n  assertAvailableGatewayModels(config);\n  await applyProfileConfig(config);\n  const profile = findProfileForOpen(config, profileOptions.profileRef);\n  const surface = profileOptions.surface ?? defaultProfileOpenSurface(profile);\n  const resolvedSurface = resolveProfileOpenSurface(profile, surface);\n  if (profile.agent === \"zcode\" && profileOptions.agentArgs.length > 0) {\n    throw new Error(\"ZCode profiles can only open the app; agent arguments are not supported.\");\n  }\n  if (profile.agent === \"claude-design\") {\n    throw new Error(\"Claude Design profiles can only be opened from CCR Desktop.\");\n  }\n  if (profile.agent === \"claude-code\" && resolvedSurface === \"app\" && profileOptions.agentArgs.length > 0) {\n    throw new Error(\"Claude App profiles do not support agent arguments.\");\n  }\n  if (profile.agent === \"codex\" && resolvedSurface === \"app\" && profileOptions.agentArgs.length === 0) {\n    const state = await startService({\n      command: \"start\",\n      daemonChild: false,\n      ensureGatewayRunning: true,\n      help: false,\n      open: false,\n      profileManaged: false,\n      startGateway: true\n    });\n    const opened = await callServiceRpc<ProfileOpenResult>(state, \"openProfile\", [{ profileId: profile.id, surface: \"app\" }], 30_000);\n    process.stdout.write(`${opened.message}\\n`);\n    return;\n  }","sourceCodeStart":107,"sourceCodeEnd":143,"githubUrl":"https://github.com/musistudio/claude-code-router/blob/99f24806c6a2c660b16e53e95211c517448a6c90/packages/cli/src/cli.ts#L107-L143","documentation":"Thrown when the account endpoint declares JSON (or sniffs as JSON) but JSON.parse fails on the body. The transport and content type checks passed; the payload itself is syntactically invalid JSON.","triggerScenarios":"result.ok is true, responseLooksJson returns true (contentType includes 'json' or body looks like JSON), but JSON.parse(text) throws — e.g. truncated response, JSONP callback wrapper, BOM/prefix garbage, or a partially streamed body.","commonSituations":"Truncated response due to proxy timeouts or content-length mismatch; server concatenating multiple JSON objects; encoding issues (UTF-16, BOM); debug endpoints wrapping JSON in logs; CDN edge caching a corrupted response.","solutions":["Log/inspect the raw text to find where JSON syntax breaks (truncation, wrapper, BOM)","Fix server-side serialization or proxy buffering causing truncation","If the endpoint wraps JSON (JSONP, )]}', prefix), strip the wrapper before parsing or point at a clean JSON endpoint","Retry once — transient truncation from flaky proxies is common"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"function isParsableJson(text: string): boolean {\n  try { JSON.parse(text); return true; } catch { return false; }\n}\n\nif (!isParsableJson(result.text ?? '')) { /* handle before calling */ }","typeGuard":"function isValidJsonPayload(text: string): text is string {\n  try { JSON.parse(text); return true; } catch { return false; }\n}","tryCatchPattern":"try {\n  return await parseWebContentFetchResult(result);\n} catch (error) {\n  if (error instanceof Error && error.message.includes('malformed JSON')) {\n    return await retryFetchOnce(); // transient truncation\n  }\n  throw error;\n}","preventionTips":["Retry once on malformed JSON — proxies often truncate transiently","Sniff for wrappers (BOM, JSONP, log prefixes) before parsing","Compare Content-Length against actual body length when available"],"tags":["json","parse-error","http","account-linking"],"backgroundTag":"json-parse-error","analyzedSha":"99f24806c6a2c660b16e53e95211c517448a6c90","analyzedAt":"2026-08-27T04:11:01.184Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}