{"record":{"id":"c970c0c33ce24529","repo":"yikart/AiToEarn","slug":"error-c970c0","errorCode":null,"errorMessage":"获取上传参数失败,失败原因:","messagePattern":"获取上传参数失败,失败原因:","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"project/aitoearn-electron/electron/plat/shipinhao/index.ts","lineNumber":629,"sourceCode":"      scene: 7,\n    };\n\n    const res = await this.makeRequest(\n      this.getPublishUploadParamsUrl,\n      {\n        method: 'POST',\n        headers: {\n          Cookie: cookieString,\n        },\n        body: requestParams,\n      },\n      proxy,\n    );\n\n    if (res.errCode === 0) {\n      return res.data;\n    } else {\n      throw new Error('获取上传参数失败,失败原因:' + (res.errMsg ?? '未知'));\n    }\n  }\n\n  /**\n   * 上传视频文件\n   * @param filePath\n   * @param uploadParams\n   * @param filePartInfo\n   * @param proxy\n   */\n  private async uploadVideoFile(\n    filePath: string,\n    uploadParams: any,\n    filePartInfo: any,\n    proxy: string,\n  ): Promise<string> {\n    try {\n      // 拼接请求参数","sourceCodeStart":611,"sourceCodeEnd":647,"githubUrl":"https://github.com/yikart/AiToEarn/blob/d3aa8bea5b146a8675607cf0144d891aad3e9683/project/aitoearn-electron/electron/plat/shipinhao/index.ts#L611-L647","documentation":"getPublishUploadParams fetches COS/Tencent-cloud upload credentials from the Shipinhao backend. A non-zero errCode in the response causes this throw with the server errMsg appended. Without these params (UploadID flow params), the subsequent video upload cannot proceed.","triggerScenarios":"Calling getPublishUploadParams / uploadParams when the server returns errCode != 0 — typically invalid cookies, expired session, risk control, or wrong/missing request parameters (traceKey, title, etc.).","commonSituations":"Expired WeChat login cookies, publish params constructed from a stale traceKey, Shipinhao API changes, or network path through an unstable proxy causing session rejection.","solutions":["Inspect the appended errMsg to identify the server reason.","Re-login to refresh cookies and obtain a fresh traceKey before requesting upload params.","Confirm all request fields match the current Shipinhao API contract.","Check account publish permissions / risk-control status in the WeChat Channels app."],"exampleFix":"null","handlingStrategy":"try-catch","validationCode":"// ensure a fresh traceKey exists before requesting upload params\nif (!traceKey) throw new Error('traceKey required before uploadParams');","typeGuard":"function hasUploadParams(res: { errCode: number; data?: any }): res is { errCode: 0; data: Record<string, unknown> } {\n  return res.errCode === 0 && res.data != null;\n}","tryCatchPattern":"try {\n  const params = await service.uploadParams(cookie, traceKey, proxy);\n} catch (e) {\n  const reason = e.message.replace('获取上传参数失败,失败原因:', '');\n  console.error('uploadParams rejected:', reason);\n  // refresh cookies/traceKey and retry once\n}","preventionTips":["Always request upload params immediately after a fresh traceKey","Refresh expired cookies proactively","Log the appended errMsg for the server-side reason","Verify account publish permissions in WeChat Channels"],"tags":["shipinhao","upload","api-error","wechat"],"backgroundTag":"api-errcode-nonzero","analyzedSha":"d3aa8bea5b146a8675607cf0144d891aad3e9683","analyzedAt":"2026-08-31T14:19:24.185Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}