yikart/AiToEarn · error · Error

上传视频失败,失败原因1:

Error message

上传视频失败,失败原因1:

What it means

This is the catch-all wrapper in uploadVideoFile: any error thrown inside the video upload try block (including errors 364/365 or network exceptions) is re-thrown prefixed with '上传视频失败,失败原因1:' and the original message. It is a wrapped error, so the root cause is in the appended message.

Source

Thrown at project/aitoearn-electron/electron/plat/shipinhao/index.ts:770

          Authorization: uploadParams.authKey,
          'Content-Type': 'application/json',
          'X-Arguments': uploadArgumentsString,
        },
        undefined,
        proxy,
      );

      if (!uploadCompleteRes.DownloadURL) {
        throw new Error('上传视频失败,失败原因2:合并分片失败');
      }

      return uploadCompleteRes.DownloadURL.replace(
        'http://wxapp.tc.qq.com',
        'https://finder.video.qq.com',
      );
    } catch (err: any) {
      const errorMessage = err?.message || err || '未知';
      throw new Error('上传视频失败,失败原因1:' + errorMessage);
    }
  }

  /**
   * 上传封面文件
   * @param filePath
   * @param uploadParams
   */
  private async uploadCoverFile(
    filePath: string,
    uploadParams: any,
    proxy: string,
  ): Promise<string> {
    try {
      const fileRes = await getFileContent(filePath);

      // 图片数据
      const fileData = fileRes;

View on GitHub (pinned to d3aa8bea5b)

Solutions

  1. Parse the text after '失败原因1:' to find the underlying cause and apply that fix.
  2. Retry the upload with a fresh upload-param request; ensure network/proxy stability.
  3. For very large videos, check timeouts and consider retrying with the file verified locally first.
  4. Add resumable/retry logic around individual chunk uploads before the complete call.

Example fix

null
Defensive patterns

Strategy: try-catch

Validate before calling

// verify file and network before initiating
if (!fs.existsSync(videoPath)) throw new Error('video file missing');
if (!uploadParams) throw new Error('upload params missing');

Try / catch

try {
  await service.uploadVideoFile(/*...*/);
} catch (e) {
  if (e.message.startsWith('上传视频失败,失败原因1:')) {
    const rootCause = e.message.slice('上传视频失败,失败原因1:'.length);
    console.error('video upload root cause:', rootCause);
    // branch on rootCause (timeout / 获取上传id失败 / 合并分片失败)
  }
}

Prevention

When it happens

Trigger: Any exception inside uploadVideoFile — fetch failures during chunk upload, missing UploadID, failed merge, JSON parse errors from the COS endpoints, or proxy connection drops.

Common situations: Unstable network/proxy during large video uploads, expired upload sessions mid-transfer, COS throttling, or disk read errors streaming the file.

Related errors


AI-assisted analysis of yikart/AiToEarn@d3aa8bea5b (2026-08-31). Data as JSON: /api/errors/ef8ad52e0ba68cf2. Report an issue: GitHub.