{"record":{"id":"28c99a3becae40f2","repo":"paperclipai/paperclip","slug":"could-not-parse-claude-cli-usage-output","errorCode":null,"errorMessage":"Could not parse Claude CLI usage output.","messagePattern":"Could not parse Claude CLI usage output\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/adapters/claude-local/src/server/quota.ts","lineNumber":484,"sourceCode":"      continue;\n    }\n    if (current) current.lines.push(line);\n  }\n  if (current) sections.push(current);\n\n  const windows = sections.map<QuotaWindow>((section) => {\n    const usedPercent = section.lines.map(percentFromLine).find((value) => value != null) ?? null;\n    return {\n      label: section.label,\n      usedPercent,\n      resetsAt: null,\n      valueLabel: null,\n      detail: formatClaudeCliDetail(section.label, section.lines),\n    };\n  });\n\n  if (!windows.some((window) => normalizeForLabelSearch(window.label) === \"currentsession\")) {\n    throw new Error(\"Could not parse Claude CLI usage output.\");\n  }\n  return windows;\n}\n\nfunction quoteForShell(value: string): string {\n  return `'${value.replace(/'/g, `'\\\\''`)}'`;\n}\n\nfunction buildClaudeCliShellProbeCommand(): string {\n  const feed = \"(sleep 2; printf '/usage\\\\r'; sleep 6; printf '\\\\033'; sleep 1; printf '\\\\003')\";\n  const claudeCommand = \"claude --tools \\\"\\\"\";\n  if (process.platform === \"darwin\") {\n    return `${feed} | script -q /dev/null ${claudeCommand}`;\n  }\n  return `${feed} | script -q -e -f -c ${quoteForShell(claudeCommand)} /dev/null`;\n}\n\nexport async function captureClaudeCliUsageText(timeoutMs = 12_000): Promise<string> {","sourceCodeStart":466,"sourceCodeEnd":502,"githubUrl":"https://github.com/paperclipai/paperclip/blob/3f1d897a7c018d76563a21c6e39c3c9b03933622/packages/adapters/claude-local/src/server/quota.ts#L466-L502","documentation":"Error \"Could not parse Claude CLI usage output.\" thrown in paperclipai/paperclip.","triggerScenarios":"Thrown at packages/adapters/claude-local/src/server/quota.ts:422 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Upgrade the Claude CLI; the usage output format may have changed.","Run `claude /usage` manually to check output."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3f1d897a7c018d76563a21c6e39c3c9b03933622","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}