yikart/AiToEarn · error · Error
上传视频失败,失败原因2:合并分片失败
Error message
上传视频失败,失败原因2:合并分片失败
What it means
After all video chunks are uploaded, ShipinhaoService calls the complete/merge endpoint and expects a DownloadURL in the response. If it is missing, the multipart merge failed on the server side and this error is thrown. The upload never produced a usable remote video URL.
Source
Thrown at project/aitoearn-electron/electron/plat/shipinhao/index.ts:761
const completeBody = {
TransFlag: '0_0',
PartInfo: uploadPartInfo,
};
const uploadCompleteRes = await this.uploadFile(
this.uploadCompleteUrl + `?UploadID=${uploadId}`,
Buffer.from(JSON.stringify(completeBody)),
{
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(View on GitHub (pinned to d3aa8bea5b)
Solutions
- Re-run the whole uploadVideoFile flow with fresh upload params; partial merges cannot be resumed here.
- Verify every part upload returned an ETag and record parts correctly before calling complete.
- Check network stability (especially through proxy) during chunk uploads.
- Inspect uploadCompleteRes body for a COS error code (e.g. NoSuchUpload, InvalidPart) and fix accordingly.
Example fix
null
Defensive patterns
Strategy: retry
Validate before calling
// confirm every part reported an ETag before calling complete
if (uploadPartInfo.some(p => !p.ETag)) {
throw new Error('some parts missing ETag — redo part uploads');
} Type guard
function hasDownloadUrl(res: unknown): res is { DownloadURL: string } {
return typeof (res as any)?.DownloadURL === 'string' && (res as any).DownloadURL.length > 0;
} Try / catch
try {
const url = await service.uploadVideoFile(/*...*/);
} catch (e) {
if (e.message.includes('合并分片失败')) {
// restart upload with fresh params; merge failures are not resumable here
}
} Prevention
- Track ETag for every uploaded part and verify before complete
- Keep the network stable during large multipart uploads (avoid flaky proxies)
- Complete the merge promptly to avoid UploadID/session expiry
- Retry the entire upload on merge failure rather than resuming
When it happens
Trigger: uploadVideoFile → complete-upload request returns a payload without DownloadURL: one or more parts failed integrity checks (bad ETag/MD5), not all parts were uploaded, or the COS complete call was rejected (signature/session expired mid-upload).
Common situations: Network interruption during part uploads leaving the merge with missing parts, very large videos timing out, session expiry between part uploads and the complete call, or COS returning an error body without DownloadURL.
Related errors
AI-assisted analysis of yikart/AiToEarn@d3aa8bea5b (2026-08-31).
Data as JSON: /api/errors/45a52676486b3557.
Report an issue: GitHub.