{"record":{"id":"14ded2676238d4d2","repo":"paperclipai/paperclip","slug":"choose-either-oauth-only-or-cli-only-not-both","errorCode":null,"errorMessage":"Choose either --oauth-only or --cli-only, not both.","messagePattern":"Choose either --oauth-only or --cli-only, not both\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"packages/adapters/claude-local/src/cli/quota-probe.ts","lineNumber":36,"sourceCode":"}\n\nfunction parseArgs(argv: string[]): ProbeArgs {\n  return {\n    json: argv.includes(\"--json\"),\n    includeRawCli: argv.includes(\"--raw-cli\"),\n    oauthOnly: argv.includes(\"--oauth-only\"),\n    cliOnly: argv.includes(\"--cli-only\"),\n  };\n}\n\nfunction stringifyError(error: unknown): string {\n  return error instanceof Error ? error.message : String(error);\n}\n\nasync function main() {\n  const args = parseArgs(process.argv.slice(2));\n  if (args.oauthOnly && args.cliOnly) {\n    throw new Error(\"Choose either --oauth-only or --cli-only, not both.\");\n  }\n\n  const authStatus = await readClaudeAuthStatus();\n  const token = await readClaudeToken();\n\n  const result: Record<string, unknown> = {\n    timestamp: new Date().toISOString(),\n    authStatus,\n    tokenAvailable: token != null,\n  };\n\n  if (!args.cliOnly) {\n    if (!token) {\n      result.oauth = {\n        ok: false,\n        error: \"No Claude OAuth access token found in local credentials files.\",\n        windows: [],\n      };","sourceCodeStart":18,"sourceCodeEnd":54,"githubUrl":"https://github.com/paperclipai/paperclip/blob/67001ec6eb96ae601aa27bc91d9b2415d665334a/packages/adapters/claude-local/src/cli/quota-probe.ts#L18-L54","documentation":"Thrown by the Claude quota-probe CLI main() when both --oauth-only and --cli-only flags are passed. The two flags are mutually exclusive because they restrict the probe to a single quota source; passing both is a contradictory instruction with no valid interpretation, so the CLI refuses rather than picking one arbitrarily.","triggerScenarios":"Invoking the quota-probe binary with both flags: `node quota-probe.js --oauth-only --cli-only`. parseArgs sets both booleans true and main() throws before doing any work.","commonSituations":"A wrapper script that concatenates flags conditionally and ends up setting both; copy-paste from two example invocations; a cron/job template that listed both options.","solutions":["Pass at most one of --oauth-only or --cli-only; omitting both runs both probes (the default).","Audit the calling script/wrapper for logic that can set both flags simultaneously.","Use --json to get structured output and filter the section you want client-side instead of restricting in-process."],"exampleFix":"// before\nnode quota-probe.js --oauth-only --cli-only\n// after\nnode quota-probe.js --oauth-only","handlingStrategy":"validation","validationCode":"if (args.oauthOnly && args.cliOnly) {\n  console.error(\"Pass at most one of --oauth-only / --cli-only\");\n  process.exit(2);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Build CLI flag combinations with a single selector (--source oauth|cli|both) instead of two booleans.","Validate flag exclusivity in wrapper scripts before invoking the probe.","Document the mutual exclusion next to the flag definitions."],"tags":["cli","arguments","quota","claude","validation"],"backgroundTag":null,"analyzedSha":"67001ec6eb96ae601aa27bc91d9b2415d665334a","analyzedAt":"2026-08-12T12:05:45.408Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}