{"record":{"id":"f2c6a8fd1d6bf239","repo":"eyaltoledano/claude-task-master","slug":"poll-failed","errorCode":"POLL_FAILED","errorMessage":"errorData.message || `HTTP ${response.status}`","messagePattern":"errorData\\.message \\|\\| `HTTP (.+?)`","errorType":"error_code","errorClass":"AuthenticationError","httpStatus":null,"severity":"error","filePath":"packages/tm-core/src/modules/auth/services/oauth-service.ts","lineNumber":345,"sourceCode":"\t\t\t\t\tmethod: 'GET',\n\t\t\t\t\theaders: {\n\t\t\t\t\t\t'User-Agent': `TaskMasterCLI/${this.getCliVersion()}`\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\tif (!response.ok) {\n\t\t\t\t\tconst errorData = (await response.json().catch(() => ({}))) as {\n\t\t\t\t\t\tmessage?: string;\n\t\t\t\t\t};\n\n\t\t\t\t\tif (response.status === 404) {\n\t\t\t\t\t\tthrow new AuthenticationError(\n\t\t\t\t\t\t\t'Authentication flow expired or not found',\n\t\t\t\t\t\t\t'FLOW_NOT_FOUND'\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tthrow new AuthenticationError(\n\t\t\t\t\t\terrorData.message || `HTTP ${response.status}`,\n\t\t\t\t\t\t'POLL_FAILED'\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tconst data = (await response.json()) as FlowStatusResponse;\n\n\t\t\t\tif (!data.success) {\n\t\t\t\t\tthrow new AuthenticationError(\n\t\t\t\t\t\tdata.message || 'Failed to check status',\n\t\t\t\t\t\t'POLL_FAILED'\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tswitch (data.status) {\n\t\t\t\t\tcase 'complete': {\n\t\t\t\t\t\t// Decrypt tokens using our private key\n\t\t\t\t\t\tif (!data.encrypted_tokens) {","sourceCodeStart":327,"sourceCodeEnd":363,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/packages/tm-core/src/modules/auth/services/oauth-service.ts#L327-L363","documentation":"AuthenticationError thrown when the flow-status poll returns any non-2xx, non-404 status. It carries the server-provided error message when the body parses as JSON, otherwise the raw HTTP status, and terminates the polling loop for the authentication flow.","triggerScenarios":"pollForCompletion receives response.ok === false with a status other than 404 — e.g. 401 from expired proxy credentials, 429 rate limiting from polling too aggressively, 500/502/503 from backend errors or a failing proxy.","commonSituations":"Long polling intervals too short hitting server rate limits; backend deployment or outage mid-login; gateway/ingress returning 502 during upstream restarts; auth service requiring a session/cookie the CLI doesn't send.","solutions":["Read the message (server error text or HTTP status) and address the indicated cause server-side.","On 429, increase the polling interval or reduce concurrent logins, then retry the flow.","On 5xx, retry after a short wait or restart the authentication flow if the backend remains unhealthy.","Check backend/gateway logs around the failure time to identify the upstream error.","Confirm no auth middleware in front of /api/auth/cli/status is rejecting unauthenticated CLI requests."],"exampleFix":"// before: aggressive polling\nawait oauth.pollForCompletion(flowId, 60000); // polls every ~1s -> 429 POLL_FAILED\n// after: catch, inspect status, retry with backoff or restart\ntry {\n  await oauth.pollForCompletion(flowId, 60000);\n} catch (e) {\n  if (e.code === 'POLL_FAILED' && e.message.includes('429')) {\n    await new Promise(r => setTimeout(r, 5000));\n    await oauth.pollForCompletion(flowId, 60000);\n  }\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":"function isPollFailed(e: unknown): e is AuthenticationError {\n  return e instanceof AuthenticationError && (e as any).code === 'POLL_FAILED';\n}","tryCatchPattern":"try {\n  await oauth.pollForCompletion(flowId, timeout);\n} catch (e) {\n  if (isPollFailed(e)) {\n    if (/429/.test(e.message)) {\n      await new Promise(r => setTimeout(r, 5000)); // back off on rate limit\n    } else {\n      console.error(`Poll failed: ${e.message} — check auth server health`);\n    }\n  }\n}","preventionTips":["Use conservative polling intervals to avoid server rate limits (429)","Monitor auth server health/deployments during login windows","Check gateway/proxy logs when seeing 5xx statuses mid-login","Retry on transient 5xx/429; restart the flow for persistent failures"],"tags":["http-error","polling","oauth","backend-api"],"backgroundTag":"http-request-failed","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}