jlcodes99/cockpit-tools · error

[TraeAutoCheckin] 账号 ${account.id} 签到异常:

Error message

[TraeAutoCheckin] 账号 ${account.id} 签到异常:

What it means

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.

Source

Thrown at src/services/traeAutoCheckinService.ts:353

            message: '今日已完成签到',
          });
        } else {
          console.log(`[TraeAutoCheckin] 为账号 ${emailDisplay} 执行签到...`);
          const result = await claimTraeCheckin(account.id);
          didCheckinAny = true;
          successCount++;
          details.push({
            accountId: account.id,
            email: emailDisplay,
            status: 'success',
            time: accountCheckinTime,
            message: result.message || '签到成功',
            credit: result.total_credits,
          });
        }
      } catch (accountErr) {
        const errMsg = accountErr instanceof Error ? accountErr.message : String(accountErr);
        console.warn(`[TraeAutoCheckin] 账号 ${account.id} 签到异常:`, accountErr);
        retryNeeded = true;
        failedCount++;
        details.push({
          accountId: account.id,
          email: emailDisplay,
          status: 'failed',
          time: accountCheckinTime,
          message: errMsg,
        });
      }
    }

    // 更新最后检查日期
    saveTraeAutoCheckinConfig({
      ...config,
      lastCheckedDate: todayStr,
    });

View on GitHub (pinned to 1ed8b77992)

Solutions

  1. Re-authenticate or refresh credentials for the failing account and re-run
  2. Check network/proxy availability and retry the cycle (the code already sets retryNeeded)
  3. Inspect the logged accountErr for the underlying status/message and fix that root cause
  4. Verify the provider checkin endpoint contract still matches the parsing code

Example fix

// before
const result = await performCheckin(account);
// after
if (!resp.ok) throw new Error(`checkin HTTP ${resp.status}: ${await resp.text()}`);
const result = await performCheckin(account);
Defensive patterns

Strategy: retry

Validate before calling

if (typeof navigator !== 'undefined' && !navigator.onLine) {
  throw new Error('offline: skipping checkin this cycle');
}

Type guard

function isAuthError(err: unknown): boolean {
  const msg = err instanceof Error ? err.message : String(err);
  return /401|403|unauthorized|token/i.test(msg);
}

Try / catch

try {
  await performCheckin(account);
} catch (accountErr) {
  const errMsg = accountErr instanceof Error ? accountErr.message : String(accountErr);
  console.warn(`[TraeAutoCheckin] 账号 ${account.id} 签到异常:`, errMsg);
  if (isAuthError(accountErr)) await refreshCredentials(account);
  retryNeeded = true; failedCount++;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of jlcodes99/cockpit-tools@1ed8b77992 (2026-09-05). Data as JSON: /api/errors/bfbc3a4973ed57d3. Report an issue: GitHub.