{"record":{"id":"008c6e372197b96b","repo":"xpzouying/xiaohongshu-mcp","slug":"error-008c6e","errorCode":null,"errorMessage":"查找旧版发布按钮失败","messagePattern":"查找旧版发布按钮失败","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"xiaohongshu/publish.go","lineNumber":513,"sourceCode":"\t\t}\n\t\tif isPublish != nil && *isPublish == \"false\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tsubmitDisabled, err := widget.Attribute(\"submit-disabled\")\n\t\tif err != nil {\n\t\t\treturn nil, \"\", errors.Wrap(err, \"读取新版发布按钮 submit-disabled 属性失败\")\n\t\t}\n\t\tif submitDisabled != nil && *submitDisabled == \"true\" {\n\t\t\treturn &publishButton{elem: widget, isWidget: true}, \"新版发布按钮不可点击\", nil\n\t\t}\n\n\t\treturn &publishButton{elem: widget, isWidget: true}, \"\", nil\n\t}\n\n\toldButtons, err := page.Elements(\".publish-page-publish-btn button.bg-red\")\n\tif err != nil {\n\t\treturn nil, \"\", errors.Wrap(err, \"查找旧版发布按钮失败\")\n\t}\n\n\tfor _, oldButton := range oldButtons {\n\t\tif !isElementVisible(oldButton) {\n\t\t\tcontinue\n\t\t}\n\n\t\tif disabled, err := oldButton.Attribute(\"disabled\"); err != nil {\n\t\t\treturn nil, \"\", errors.Wrap(err, \"读取旧版发布按钮 disabled 属性失败\")\n\t\t} else if disabled != nil {\n\t\t\treturn &publishButton{elem: oldButton}, \"旧版发布按钮 disabled\", nil\n\t\t}\n\n\t\tif ariaDisabled, err := oldButton.Attribute(\"aria-disabled\"); err != nil {\n\t\t\treturn nil, \"\", errors.Wrap(err, \"读取旧版发布按钮 aria-disabled 属性失败\")\n\t\t} else if ariaDisabled != nil && *ariaDisabled == \"true\" {\n\t\t\treturn &publishButton{elem: oldButton}, \"旧版发布按钮 aria-disabled=true\", nil\n\t\t}","sourceCodeStart":495,"sourceCodeEnd":531,"githubUrl":"https://github.com/xpzouying/xiaohongshu-mcp/blob/332d196854a9eac0d2b8c2c0e3d0cc43139d724c/xiaohongshu/publish.go#L495-L531","documentation":"findPublishButton wraps failures from page.Elements(\".publish-page-publish-btn button.bg-red\") — the legacy publish button selector — with this message. This fallback only runs when no new-style widget was found; the query failing means the old-version button could not even be searched.","triggerScenarios":"The CSS-selector query against the browser errors: page crashed or navigating, execution context destroyed, or the tab closed while probing the legacy selector.","commonSituations":"Publishing on a Xiaohongshu page version where neither button style is present; page reload mid-probe; browser instability.","solutions":["If it propagates (it normally is retried by the polling loop), retry the publish","Confirm the publish page actually loaded (check URL /publish/publish)","Check the browser tab is alive and not crashed","Update the library if Xiaohongshu removed the legacy button markup"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// 确认发布页已加载\nif !strings.Contains(pageMustInfo(page).URL, \"/publish/publish\") {\n    return errors.New(\"尚未进入小红书发布页\")\n}","typeGuard":null,"tryCatchPattern":"err := xhs.Publish(...)\nif err != nil && strings.Contains(err.Error(), \"查找旧版发布按钮失败\") {\n    err = xhs.Publish(...) // 轮询内部会自动重试；此处兜底\n}","preventionTips":["Wait for the publish page to fully load before publishing","Keep the tab open and browser stable","Rely on internal polling; only retry if the error escapes","Update the library if the legacy selector disappears from the platform"],"tags":["browser-automation","rod","css-selector"],"backgroundTag":"element-query-failed","analyzedSha":"332d196854a9eac0d2b8c2c0e3d0cc43139d724c","analyzedAt":"2026-09-05T22:22:55.988Z","contentChangedAt":"2026-09-05T22:22:55.988Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}