{"record":{"id":"87eee1b425218d8f","repo":"yikart/AiToEarn","slug":"error-87eee1","errorCode":null,"errorMessage":"服务器多次返回空数据，请检查网络连接或抖音服务器状态","messagePattern":"服务器多次返回空数据，请检查网络连接或抖音服务器状态","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"project/aitoearn-electron/electron/plat/douyin/index.ts","lineNumber":2352,"sourceCode":"          throw new Error(`服务器返回错误状态码: ${response.status}`);\n        }\n\n        const responseText = await response.text();\n\n        // 检查响应数据是否为空\n        if (!responseText || responseText.trim() === '') {\n          console.error(\n            `响应数据为空，尝试次数: ${retryCount + 1}/${maxRetries}`,\n          );\n\n          if (retryCount < maxRetries - 1) {\n            retryCount++;\n            console.log(`等待${retryDelay / 1000}秒后重试...`);\n            await new Promise((resolve) => setTimeout(resolve, retryDelay));\n            continue;\n          }\n\n          throw new Error(\n            '服务器多次返回空数据，请检查网络连接或抖音服务器状态',\n          );\n        }\n\n        try {\n          const result = JSON.parse(responseText);\n\n          if (!result) {\n            console.error(`解析后的数据为空`);\n            throw new Error('解析后的数据为空');\n          }\n\n          return result;\n        } catch (err) {\n          console.error(`解析响应数据失败:`, err);\n          console.error(`导致错误的原始数据:`, responseText);\n          throw new Error(\n            `解析响应数据失败: ${err instanceof Error ? err.message : String(err)}`,","sourceCodeStart":2334,"sourceCodeEnd":2370,"githubUrl":"https://github.com/yikart/AiToEarn/blob/d3aa8bea5b146a8675607cf0144d891aad3e9683/project/aitoearn-electron/electron/plat/douyin/index.ts#L2334-L2370","documentation":"This is thrown by DouyinService's private postFormData helper (project/aitoearn-electron/electron/plat/douyin/index.ts:2352) after the response body from a creator.douyin.com form-data POST came back empty (null/whitespace-only) on every attempt. The helper retries up to maxRetries (default 3) with retryDelay (default 2000ms) between attempts, and only throws this once the retry budget is exhausted. It signals that Douyin's server (or an intervening network/proxy layer) is accepting the request but returning no body.","triggerScenarios":"Any DouyinService method that routes through postFormData (e.g. creatorDianzanOther, comment reply/post operations) when response.text() returns '' or whitespace-only on all maxRetries consecutive attempts against creator.douyin.com endpoints.","commonSituations":"Expired or invalid Douyin login cookies causing the server to respond with an empty 200 body; Douyin rate-limiting or risk-control silently dropping the response; transient network/proxy failures that truncate the response; Douyin server-side incidents; firewall or VPN interference with the request.","solutions":["Check and refresh the Douyin account cookie passed to the service — re-login and rebuild the cookie array, since invalid sessions commonly yield empty bodies.","Verify general network connectivity from the Electron machine (curl the endpoint URL) and check any proxy/VPN settings.","Retry later or reduce call frequency — Douyin risk control may throttle frequent automated calls; add larger retryOptions.retryDelay or maxRetries when calling the service.","Check Douyin creator platform server status; if the platform itself is degraded, wait for recovery."],"exampleFix":"// before\nawait douyinService.creatorDianzanOther(cookie, data);\n// after\nif (!cookie || cookie.length === 0) {\n  throw new Error('Douyin cookie is empty, please re-login');\n}\nawait douyinService.creatorDianzanOther(cookie, data, { maxRetries: 5, retryDelay: 3000 });","handlingStrategy":"retry","validationCode":"if (!cookie || cookie.length === 0) throw new Error('Douyin cookie missing, re-login required');\nconst netOk = await fetch('https://creator.douyin.com', { method: 'HEAD' }).then(r => r.ok).catch(() => false);\nif (!netOk) throw new Error('No connectivity to creator.douyin.com');","typeGuard":"function isNonEmptyBody(text: unknown): text is string {\n  return typeof text === 'string' && text.trim().length > 0;\n}","tryCatchPattern":"try {\n  const result = await douyinService.someOp(cookie, data);\n} catch (e) {\n  if (String(e.message).includes('服务器多次返回空数据')) {\n    await refreshDouyinCookie();\n    // retry once with longer delay, or surface a user-facing 'check network / Douyin status' message\n  } else throw e;\n}","preventionTips":["Keep Douyin cookies fresh; detect 401/empty bodies early and force re-login.","Throttle request rate to avoid Douyin risk control returning empty bodies.","Pass larger retryOptions.maxRetries/retryDelay on flaky networks.","Monitor Douyin platform status before bulk operations."],"tags":["network","douyin","empty-response","retry-exhausted"],"backgroundTag":"empty-response-body","analyzedSha":"d3aa8bea5b146a8675607cf0144d891aad3e9683","analyzedAt":"2026-08-31T14:19:24.185Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}