{"record":{"id":"bfbc3a4973ed57d3","repo":"jlcodes99/cockpit-tools","slug":"traeautocheckin-account-id","errorCode":null,"errorMessage":"[TraeAutoCheckin] 账号 ${account.id} 签到异常:","messagePattern":"\\[TraeAutoCheckin\\] 账号 (.+?) 签到异常:","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/services/traeAutoCheckinService.ts","lineNumber":353,"sourceCode":"            message: '今日已完成签到',\n          });\n        } else {\n          console.log(`[TraeAutoCheckin] 为账号 ${emailDisplay} 执行签到...`);\n          const result = await claimTraeCheckin(account.id);\n          didCheckinAny = true;\n          successCount++;\n          details.push({\n            accountId: account.id,\n            email: emailDisplay,\n            status: 'success',\n            time: accountCheckinTime,\n            message: result.message || '签到成功',\n            credit: result.total_credits,\n          });\n        }\n      } catch (accountErr) {\n        const errMsg = accountErr instanceof Error ? accountErr.message : String(accountErr);\n        console.warn(`[TraeAutoCheckin] 账号 ${account.id} 签到异常:`, accountErr);\n        retryNeeded = true;\n        failedCount++;\n        details.push({\n          accountId: account.id,\n          email: emailDisplay,\n          status: 'failed',\n          time: accountCheckinTime,\n          message: errMsg,\n        });\n      }\n    }\n\n    // 更新最后检查日期\n    saveTraeAutoCheckinConfig({\n      ...config,\n      lastCheckedDate: todayStr,\n    });\n","sourceCodeStart":335,"sourceCodeEnd":371,"githubUrl":"https://github.com/jlcodes99/cockpit-tools/blob/1ed8b77992d62ca81fabf744deb0839ad361d5bf/src/services/traeAutoCheckinService.ts#L335-L371","documentation":"Inside runTraeAutoCheckinCycleIfNeeded, each account's checkin runs in its own try/catch. Any exception thrown while performing the checkin for one account (network failure, non-2xx response, invoke error, bad payload) is caught, logged with the account id, marked as retryNeeded, and counted in failedCount. The cycle continues with remaining accounts.","triggerScenarios":"The per-account checkin HTTP request fails or rejects: network outage, expired/invalid account credentials rejected by the provider, a Rust invoke error, or a malformed response shape being destructured.","commonSituations":"Session/cookie expired since last run so the provider returns auth error; offline laptop during scheduled run; provider endpoint changed and response no longer matches expected shape.","solutions":["Re-authenticate or refresh credentials for the failing account and re-run","Check network/proxy availability and retry the cycle (the code already sets retryNeeded)","Inspect the logged accountErr for the underlying status/message and fix that root cause","Verify the provider checkin endpoint contract still matches the parsing code"],"exampleFix":"// before\nconst result = await performCheckin(account);\n// after\nif (!resp.ok) throw new Error(`checkin HTTP ${resp.status}: ${await resp.text()}`);\nconst result = await performCheckin(account);","handlingStrategy":"retry","validationCode":"if (typeof navigator !== 'undefined' && !navigator.onLine) {\n  throw new Error('offline: skipping checkin this cycle');\n}","typeGuard":"function isAuthError(err: unknown): boolean {\n  const msg = err instanceof Error ? err.message : String(err);\n  return /401|403|unauthorized|token/i.test(msg);\n}","tryCatchPattern":"try {\n  await performCheckin(account);\n} catch (accountErr) {\n  const errMsg = accountErr instanceof Error ? accountErr.message : String(accountErr);\n  console.warn(`[TraeAutoCheckin] 账号 ${account.id} 签到异常:`, errMsg);\n  if (isAuthError(accountErr)) await refreshCredentials(account);\n  retryNeeded = true; failedCount++;\n}","preventionTips":["Refresh/validate account credentials before each cycle","Check navigator.onLine before attempting network calls","Log full response bodies for provider errors to speed diagnosis","Keep per-account isolation so one failure does not abort the cycle"],"tags":["network","http","per-account-checkin"],"backgroundTag":"checkin-request-failed","analyzedSha":"1ed8b77992d62ca81fabf744deb0839ad361d5bf","analyzedAt":"2026-09-05T09:51:41.178Z","contentChangedAt":"2026-09-05T09:51:41.178Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}