yikart/AiToEarn · error · Error
上传封面失败,失败原因:合并分片失败
Error message
上传封面失败,失败原因:合并分片失败
What it means
In uploadCoverFile, after all cover parts are uploaded, the complete/merge call must return a DownloadURL; if it does not, this error is thrown indicating the multipart merge failed server-side. The cover is not published and the video publish flow should abort or retry.
Source
Thrown at project/aitoearn-electron/electron/plat/shipinhao/index.ts:878
const uploadCompleteRes = await this.uploadFile(
this.uploadCompleteUrl + `?UploadID=${uploadId}`,
Buffer.from(
JSON.stringify({
TransFlag: '0_0',
PartInfo: uploadPartInfo,
}),
),
{
Authorization: uploadParams.authKey,
'Content-Type': 'application/json',
'X-Arguments': uploadArgumentsString,
},
undefined,
proxy,
);
if (!uploadCompleteRes.DownloadURL) {
throw new Error('上传封面失败,失败原因:合并分片失败');
}
return uploadCompleteRes.DownloadURL;
} catch (err: any) {
const errorMessage = err?.message || err || '未知';
throw new Error('上传封面失败,失败原因:' + errorMessage);
}
}
/**
* 提交官方剪辑任务
*/
private async postClipUploadVideo(
traceKey: string,
startUploadTime: number,
endUploadTime: number,
remoteFileUrl: string,
fileInfo: any,View on GitHub (pinned to d3aa8bea5b)
Solutions
- Retry the whole cover upload with freshly obtained upload params.
- Confirm each part upload returned an ETag before invoking the complete call.
- Inspect uploadCompleteRes for a COS error code and address it (e.g. re-sign, reduce delay).
- Check proxy/network stability during the cover upload sequence.
Example fix
null
Defensive patterns
Strategy: retry
Validate before calling
// ensure all parts succeeded before complete
if (!lastPartRes?.ETag) throw new Error('last cover part missing ETag'); 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 coverUrl = await service.uploadCoverFile(/*...*/);
} catch (e) {
if (e.message.includes('合并分片失败')) {
// restart cover upload with fresh upload params
}
} Prevention
- Verify each part upload returned an ETag before the complete call
- Complete the merge soon after part uploads to avoid UploadID expiry
- Keep network/proxy stable across the whole cover upload
- Retry the full cover upload on merge failure
When it happens
Trigger: uploadCoverFile → complete-upload response lacks DownloadURL: part integrity check failure, missing parts, expired upload session before complete, or COS returning an error body.
Common situations: Interrupted part upload (network/proxy drop) making the merge invalid, stale UploadID after long delays, or COS rejecting due to InvalidPart/NoSuchUpload.
Related errors
AI-assisted analysis of yikart/AiToEarn@d3aa8bea5b (2026-08-31).
Data as JSON: /api/errors/62719b8cb28f50c4.
Report an issue: GitHub.