yikart/AiToEarn · error · Error
获取上传参数失败,失败原因:
Error message
获取上传参数失败,失败原因:
What it means
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.
Source
Thrown at project/aitoearn-electron/electron/plat/shipinhao/index.ts:629
scene: 7,
};
const res = await this.makeRequest(
this.getPublishUploadParamsUrl,
{
method: 'POST',
headers: {
Cookie: cookieString,
},
body: requestParams,
},
proxy,
);
if (res.errCode === 0) {
return res.data;
} else {
throw new Error('获取上传参数失败,失败原因:' + (res.errMsg ?? '未知'));
}
}
/**
* 上传视频文件
* @param filePath
* @param uploadParams
* @param filePartInfo
* @param proxy
*/
private async uploadVideoFile(
filePath: string,
uploadParams: any,
filePartInfo: any,
proxy: string,
): Promise<string> {
try {
// 拼接请求参数View on GitHub (pinned to d3aa8bea5b)
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.
Example fix
null
Defensive patterns
Strategy: try-catch
Validate before calling
// ensure a fresh traceKey exists before requesting upload params
if (!traceKey) throw new Error('traceKey required before uploadParams'); Type guard
function hasUploadParams(res: { errCode: number; data?: any }): res is { errCode: 0; data: Record<string, unknown> } {
return res.errCode === 0 && res.data != null;
} Try / catch
try {
const params = await service.uploadParams(cookie, traceKey, proxy);
} catch (e) {
const reason = e.message.replace('获取上传参数失败,失败原因:', '');
console.error('uploadParams rejected:', reason);
// refresh cookies/traceKey and retry once
} Prevention
- 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
When it happens
Trigger: Calling getPublishUploadParams / uploadParams when the server returns errCode != 0 — typically invalid cookies, expired session, risk control, or wrong/missing request parameters (traceKey, title, etc.).
Common situations: Expired WeChat login cookies, publish params constructed from a stale traceKey, Shipinhao API changes, or network path through an unstable proxy causing session rejection.
Related errors
AI-assisted analysis of yikart/AiToEarn@d3aa8bea5b (2026-08-31).
Data as JSON: /api/errors/c970c0c33ce24529.
Report an issue: GitHub.