yikart/AiToEarn · error
网络繁忙,请稍后重试!
Error message
网络繁忙,请稍后重试!
What it means
In VideoPubSetModal, pubCore calls icpCreatePubRecord (video publish record) and immediately assigns recordRes.id, then checks !recordRes afterwards. If the IPC/backend record creation fails, err() shows the generic toast '网络繁忙,请稍后重试!'. Note the code order is fragile: recordRes.id is read before the falsy check, so a null result can also throw before err() is reached.
Source
Thrown at project/aitoearn-electron/src/views/publish/children/videoPage/components/VideoPubSetModal/VideoPubSetModal.tsx:211
await signInApi.createSignInRecord();
const err = () => {
setLoading(false);
message.error('网络繁忙,请稍后重试!');
};
usePubStroe.getState().clearVideoPubSaveData();
// 创建一级记录
const recordRes = await icpCreatePubRecord({
title: commonPubParams.title,
desc: commonPubParams.describe,
type: PubType.VIDEO,
timingTime: commonPubParams.timingTime,
videoPath: videoListChoose[0].video?.videoPath,
coverPath: videoListChoose[0].pubParams.cover?.imgPath,
commonCoverPath: commonPubParams.cover?.imgPath,
});
recordId.current = recordRes.id;
if (!recordRes) return err();
setPubProgressModuleOpen(true);
setLoading(true);
// 发布记录通知消息初始化
const initialNotice: NoticeItem = {
title:
[
...new Set(
videoListChoose.map(
(v) => AccountPlatInfoMap.get(v.account!.type)!.name,
),
),
].join('、') + '发布任务',
time: recordRes.createTime!,
id: recordRes.id,
pub: {
status: PubStatus.UNPUBLISH,View on GitHub (pinned to d3aa8bea5b)
Solutions
- Move the `recordId.current = recordRes.id` assignment AFTER the `if (!recordRes)` check to avoid a TypeError masking the toast
- Inspect main-process logs for the real icpCreatePubRecord error
- Re-login if the session/token expired; confirm backend health
- Ensure videoPath and cover paths exist before opening the publish modal
Example fix
// before recordId.current = recordRes.id; if (!recordRes) return err(); // after if (!recordRes) return err(); recordId.current = recordRes.id;
Defensive patterns
Strategy: validation
Validate before calling
// before confirming publish in the modal
if (!videoListChoose[0]?.video?.videoPath) { message.error('视频路径无效'); return; }
if (!videoListChoose[0]?.pubParams?.cover?.imgPath) { message.error('请设置封面'); return; } Type guard
function isRecordCreated(r: unknown): r is { id: string } {
return typeof r === 'object' && r !== null && 'id' in r && typeof (r as any).id === 'string';
} Try / catch
const recordRes = await icpCreatePubRecord({ ... }).catch((e) => { console.error(e); return null; });
if (!isRecordCreated(recordRes)) return err();
recordId.current = recordRes.id; // assign only after the guard Prevention
- Move recordRes.id access after the null check
- Validate videoPath/cover exist before submitting
- Keep the session fresh; re-authenticate on 401s
- Surface backend error details in dev builds
When it happens
Trigger: icpCreatePubRecord returns falsy because the backend rejected video record creation: server unreachable, expired auth, missing videoPath/coverPath, or a backend validation/500 error on the video publish endpoint.
Common situations: Video file path invalid or not yet downloaded when publishing is confirmed; user session expired mid-flow; backend down during scheduled-publish configuration; race where cover hasn't been generated.
Related errors
AI-assisted analysis of yikart/AiToEarn@d3aa8bea5b (2026-08-31).
Data as JSON: /api/errors/2850597d1eb6c45d.
Report an issue: GitHub.