{"record":{"id":"49f0e049ee5e8e34","repo":"jackwener/OpenCLI","slug":"isdraft-tmp-wecha","errorCode":null,"errorMessage":"未能验证${isDraft ? '草稿保存' : '发布'}成功，截图已保存到 /tmp/wechat-channels_publish_result_debug.png","messagePattern":"未能验证(.+?)成功，截图已保存到 /tmp/wechat-channels_publish_result_debug\\.png","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/wechat-channels/publish.js","lineNumber":704,"sourceCode":"        ${DEEP_QUERY_FN}\n        var all = deepQueryAll('*');\n        for (var i = 0; i < all.length; i++) {\n          var el = all[i];\n          var text = (el.innerText || '').trim();\n          if (el.children.length === 0 && text) {\n            for (var j = 0; j < markers.length; j++) {\n              if (text.includes(markers[j])) return text;\n            }\n          }\n        }\n        return '';\n      })(${JSON.stringify(successMarkers)})\n    `);\n\n    const isSuccess = submitSucceeded({ isDraft, finalUrl, successMsg });\n    if (!isSuccess) {\n      await page.screenshot({ path: '/tmp/wechat-channels_publish_result_debug.png' });\n      throw new CommandExecutionError(\n        `未能验证${isDraft ? '草稿保存' : '发布'}成功，截图已保存到 /tmp/wechat-channels_publish_result_debug.png`,\n        `url=${finalUrl || ''} message=${successMsg || ''}`,\n      );\n    }\n\n    const verb = isDraft ? '草稿已保存' : '发布成功';\n    const detailParts = [\n      scheduleTime ? `定时: ${scheduleTime.toISOString()}` : null,\n      successMsg || finalUrl,\n    ].filter(Boolean);\n\n    const result = [{\n      status: `✅ ${verb}`,\n      title: title || '',\n      detail: detailParts.join(' · ') || finalUrl,\n    }];\n\n    // Leave the tab on the post list rather than the (now-submitted) create","sourceCodeStart":686,"sourceCodeEnd":722,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/wechat-channels/publish.js#L686-L722","documentation":"After submitting publish/draft, the command checks successMarkers, finalUrl, and successMsg via submitSucceeded(). If none indicate success, it throws CommandExecutionError with a debug screenshot at /tmp/wechat-channels_publish_result_debug.png, meaning the outcome could not be verified — the publish may or may not have gone through.","triggerScenarios":"submitSucceeded returned false: final URL unchanged, no success toast text found, page stuck on an error dialog or still on the edit page after submission.","commonSituations":"Submission rejected server-side (content review, missing cover); success toast appeared but with renamed text not in successMarkers; slow server left page mid-transition when markers were checked; duplicate-title rejection.","solutions":["Inspect /tmp/wechat-channels_publish_result_debug.png and the url=/message= detail in the error to see the post-submit state","Manually verify on the WeChat Channels site whether the video/draft actually published before retrying (avoid duplicates)","Wait longer after clicking submit before evaluating success markers","Add current success toast texts/URL patterns to successMarkers","Check the returned detail string for server-side rejection reasons"],"exampleFix":"// before\nconst isSuccess = submitSucceeded({ isDraft, finalUrl, successMsg });\nif (!isSuccess) { throw ... }\n// after\nawait page.waitForNavigation({ timeout: 60000 }).catch(() => {});\nconst successMsg = await page.evaluate(`(function(markers){ ... })(${JSON.stringify(successMarkers)})`);\nconst isSuccess = submitSucceeded({ isDraft, finalUrl, successMsg });","handlingStrategy":"try-catch","validationCode":"// verify submission state before declaring success\nconst state = await page.evaluate(() => ({ url: location.href, bodyText: document.body.innerText.slice(0, 2000) }));","typeGuard":"function looksSubmitted(s) {\n  return typeof s?.url === 'string' && typeof s?.bodyText === 'string' &&\n    (/发表成功|发布成功|保存成功|draft/.test(s.bodyText) || /success|published/.test(s.url));\n}","tryCatchPattern":"try {\n  await submitAndVerify(page, isDraft);\n} catch (e) {\n  if (/未能验证.*成功/.test(e.message)) {\n    console.error('Publish outcome unverified — check /tmp/wechat-channels_publish_result_debug.png and confirm on the site before retrying to avoid duplicates.');\n  } else throw e;\n}","preventionTips":["Never blindly retry after this error — check the site first to avoid duplicate posts","Wait for navigation/toast before evaluating success markers","Keep successMarkers (toast texts, URL patterns) current","Record the detail string (url=/message=) for diagnosis"],"tags":["wechat-channels","publish-verification","browser-automation"],"backgroundTag":"publish-result-unverified","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}