{"record":{"id":"ac7cec37527e1b2a","repo":"yikart/AiToEarn","slug":"error-ac7cec","errorCode":null,"errorMessage":"网络繁忙，请稍后重试！","messagePattern":"网络繁忙，请稍后重试！","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"project/aitoearn-electron/src/views/task/articleTask.tsx","lineNumber":247,"sourceCode":"\n  const pubCore = async () => {\n    if (!selectedTask) return;\n\n    setPubProgressModuleOpen(true);\n    setLoading(true);\n    const err = () => {\n      setLoading(false);\n      message.error('网络繁忙，请稍后重试！');\n    };\n\n    // 创建一级记录\n    const recordRes = await icpCreatePubRecord({\n      title: selectedTask.title,\n      desc: selectedTask.description,\n      type: PubType.ImageText,\n      coverPath: FILE_BASE_URL + (selectedTask.dataInfo?.imageList?.[0] || ''),\n    });\n    if (!recordRes) return err();\n\n    let pubList = [];\n    if (selectedTask.dataInfo?.imageList?.length > 1) {\n      pubList = selectedTask.dataInfo?.imageList.map(\n        (v: string) => FILE_BASE_URL + v,\n      );\n    }\n\n    console.log('pubList', pubList);\n    console.log(accountListChoose);\n\n    for (const account of accountListChoose) {\n      // 创建二级记录\n      await icpCreateImgTextPubRecord({\n        title: selectedTask.title,\n        desc: selectedTask.description,\n        type: account.type,\n        accountId: account.id,","sourceCodeStart":229,"sourceCodeEnd":265,"githubUrl":"https://github.com/yikart/AiToEarn/blob/d3aa8bea5b146a8675607cf0144d891aad3e9683/project/aitoearn-electron/src/views/task/articleTask.tsx#L229-L265","documentation":"In articleTask.tsx, pubCore calls icpCreatePubRecord to create an ImageText publish record for an article task, using FILE_BASE_URL-prefixed remote images as the cover. A falsy result triggers err(), showing the generic toast '网络繁忙，请稍后重试！'. The real failure (backend/IPC) is swallowed by this catch-all message.","triggerScenarios":"icpCreatePubRecord returns null/undefined: backend unreachable, auth invalid, or the payload (selectedTask title/description/cover URL) rejected — e.g., empty imageList so coverPath becomes just FILE_BASE_URL, or selectedTask.dataInfo missing.","commonSituations":"Task data not fully loaded when the user confirms publishing (dataInfo undefined); CDN file URLs broken; session expired; backend error while creating the record.","solutions":["Log the icpCreatePubRecord return and payload in main process to find the real error","Guard against missing selectedTask.dataInfo/imageList before calling (avoid coverPath = FILE_BASE_URL alone)","Verify remote cover/image URLs are reachable","Re-login and confirm backend availability"],"exampleFix":"// before\ncoverPath: FILE_BASE_URL + (selectedTask.dataInfo?.imageList?.[0] || ''),\n...\nif (!recordRes) return err();\n// after\nconst firstImg = selectedTask.dataInfo?.imageList?.[0];\nif (!firstImg) return message.error('任务素材为空，无法发布');\nconst recordRes = await icpCreatePubRecord({ ..., coverPath: FILE_BASE_URL + firstImg });\nif (!recordRes) return err();","handlingStrategy":"validation","validationCode":"// before pubCore in ArticleTask\nconst imgs = selectedTask?.dataInfo?.imageList;\nif (!Array.isArray(imgs) || imgs.length === 0) { message.error('任务素材缺失'); return; }","typeGuard":"function hasTaskData(t: unknown): t is { dataInfo: { imageList: string[]; title: string; description?: string } } {\n  return !!t && typeof t === 'object' && Array.isArray((t as any).dataInfo?.imageList) && (t as any).dataInfo.imageList.length > 0;\n}","tryCatchPattern":"if (!hasTaskData(selectedTask)) { message.error('任务数据未加载完成'); return; }\nconst recordRes = await icpCreatePubRecord({ ... }).catch(e => { console.error(e); return null; });\nif (!recordRes) return err();","preventionTips":["Wait for task data to fully load before enabling publish","Validate remote cover URLs resolve (FILE_BASE_URL + path)","Handle expired sessions by redirecting to login","Log the real IPC failure instead of only a generic toast"],"tags":["electron","ipc","publish-record","article-task"],"backgroundTag":"publish-record-creation-failed","analyzedSha":"d3aa8bea5b146a8675607cf0144d891aad3e9683","analyzedAt":"2026-08-31T14:19:24.185Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}