{"record":{"id":"6a79b617d5c1b03b","repo":"jackwener/OpenCLI","slug":"http-probe-httpstatus-from-auth-data","errorCode":null,"errorMessage":"HTTP ${probe.httpStatus} from auth_data","messagePattern":"HTTP (.+?) from auth_data","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/wechat-channels/auth.js","lineNumber":43,"sourceCode":"      });\n      if (!r.ok) return { kind: 'http', httpStatus: r.status };\n      const d = await r.json();\n      if (!d || d.base_resp?.ret !== 0) {\n        return { kind: 'auth', detail: 'WeChat Channels auth_data base_resp.ret=' + String(d?.base_resp?.ret) };\n      }\n      const fu = d.data?.finder_user || d.finder_user || {};\n      const userId = String(fu.uniq_id || fu.username || '');\n      const name = String(fu.nickname || fu.name || '');\n      if (!userId && !name) {\n        return { kind: 'auth', detail: 'WeChat Channels auth_data 200 but finder_user empty' };\n      }\n      return { ok: true, user_id: userId, name };\n    } catch (e) {\n      return { kind: 'exception', detail: String(e && e.message || e) };\n    }\n  })()`);\n  if (probe?.kind === 'auth') throw new AuthRequiredError('channels.weixin.qq.com', probe.detail);\n  if (probe?.kind === 'http') throw new CommandExecutionError(`HTTP ${probe.httpStatus} from auth_data`);\n  if (probe?.kind === 'exception') throw new CommandExecutionError(`WeChat Channels whoami failed: ${probe.detail}`);\n  if (!probe?.ok) throw new CommandExecutionError(`Unexpected WeChat Channels probe: ${JSON.stringify(probe)}`);\n  return { user_id: probe.user_id, name: probe.name };\n}\n\nregisterSiteAuthCommands({\n  site: 'wechat-channels',\n  domain: 'channels.weixin.qq.com',\n  loginUrl: 'https://channels.weixin.qq.com/login.html?from=assistant',\n  columns: ['user_id', 'name'],\n  quickCheck: hasWechatChannelsSessionCookie,\n  verify: verifyWechatChannelsIdentity,\n  poll: async (page) => {\n    if (!await hasWechatChannelsSessionCookie(page)) {\n      throw new AuthRequiredError('channels.weixin.qq.com', 'Waiting for WeChat Channels sessionid cookie');\n    }\n    return verifyWechatChannelsIdentity(page);\n  },","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/wechat-channels/auth.js#L25-L61","documentation":"The in-page probe POSTs to /cgi-bin/mmfinderassistant-bin/auth/auth_data with credentials included. If the HTTP response status is not ok (2xx), the probe returns kind:'http' and this CommandExecutionError surfaces the status code — the request itself failed at the transport/HTTP layer rather than returning an auth payload.","triggerScenarios":"Server returns 4xx/5xx from auth_data: session rejected with 401/403, rate limiting 429, server error 5xx, maintenance window, or a proxy/firewall altering the response.","commonSituations":"Transient WeChat server errors or maintenance; IP rate-limited due to frequent scripted calls; corporate proxy intercepting the request; account risk-control blocking API access.","solutions":["Note the status: 401/403 → re-login via login.html QR flow; 429 → wait and back off; 5xx → retry later.","Retry after a delay — transient 5xx/429 usually resolves.","Re-login to refresh the session if 401/403 persists.","Reduce call frequency to avoid rate limits / risk control.","Check network path (proxy/VPN) isn't intercepting channels.weixin.qq.com."],"exampleFix":"// before\nwechat-channels whoami   # HTTP 429 from auth_data\n// after\nsleep 60 && wechat-channels whoami   # back off, then retry\n// for 401/403: wechat-channels login first","handlingStrategy":"retry","validationCode":"// Parse the status from the message and branch\nconst m = /HTTP (\\d+) from auth_data/.exec(e.message);\nif (m) {\n  const status = Number(m[1]);\n  if (status === 401 || status === 403) await runLoginFlow();\n  else if (status === 429 || status >= 500) await sleep(60000);\n}","typeGuard":null,"tryCatchPattern":"try {\n  await verifyWechatChannelsIdentity(page);\n} catch (e) {\n  if (/HTTP 5\\d\\d|HTTP 429/.test(e.message)) {\n    await sleep(backoff); return verifyWechatChannelsIdentity(page); // retry with backoff\n  }\n  if (/HTTP 40[13]/.test(e.message)) { await runLoginFlow(); return verifyWechatChannelsIdentity(page); }\n  throw e;\n}","preventionTips":["Implement exponential backoff for 429/5xx","Re-login on 401/403 instead of retrying blindly","Throttle scripted call frequency to avoid rate limits","Check proxy/VPN interference if failures are consistent"],"tags":["http","network","wechat","api-error"],"backgroundTag":"http-error-response","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}