{"record":{"id":"7714928104b4798d","repo":"xpzouying/xiaohongshu-mcp","slug":"error-771492","errorCode":null,"errorMessage":"未找到原创声明选项","messagePattern":"未找到原创声明选项","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"xiaohongshu/publish.go","lineNumber":1031,"sourceCode":"\t\t}\n\n\t\t// 点击开关\n\t\tif err := humanize.Click(switchElem); err != nil {\n\t\t\treturn errors.Wrap(err, \"点击原创声明开关失败\")\n\t\t}\n\n\t\ttime.Sleep(500 * time.Millisecond)\n\n\t\t// 处理原创声明确认弹窗\n\t\tif err := confirmOriginalDeclaration(page); err != nil {\n\t\t\treturn errors.Wrap(err, \"确认原创声明失败\")\n\t\t}\n\n\t\tslog.Info(\"已开启原创声明\")\n\t\treturn nil\n\t}\n\n\treturn errors.New(\"未找到原创声明选项\")\n}\n\n// confirmOriginalDeclaration 交互（勾选须知、点声明按钮）走 go-rod 点击；\n// 仅用只读 Eval 读取 checkbox 勾选态（不产生交互，无法用属性判断的自定义组件才用）。\nfunc confirmOriginalDeclaration(page *rod.Page) error {\n\ttime.Sleep(800 * time.Millisecond) // 技术等待：等确认弹窗渲染\n\n\tif footer, err := findFooterByText(page, \"原创声明须知\"); err != nil {\n\t\tslog.Warn(\"未找到原创声明确认弹窗的 footer\", \"error\", err)\n\t} else if err := checkFooterCheckbox(footer); err != nil {\n\t\tslog.Warn(\"勾选原创声明须知失败\", \"error\", err)\n\t}\n\n\ttime.Sleep(500 * time.Millisecond) // 技术等待：勾选后等\"声明原创\"按钮变可用\n\n\tfooter, err := findFooterByText(page, \"声明原创\")\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"未找到声明原创弹窗\")","sourceCodeStart":1013,"sourceCodeEnd":1049,"githubUrl":"https://github.com/xpzouying/xiaohongshu-mcp/blob/332d196854a9eac0d2b8c2c0e3d0cc43139d724c/xiaohongshu/publish.go#L1013-L1049","documentation":"setOriginal searches the publish page for the original-declaration (原创声明) toggle/checkbox and throws this error if no matching option is found. The library looks for the declaration switch in the publish form; absence means the account/page variant doesn't expose the option, the page hasn't rendered the settings section, or XHS changed the toggle's markup.","triggerScenarios":"submitPublish calls setOriginal after filling content; the toggle selector matches nothing — option collapsed behind an '更多设置' expander that wasn't opened, page still loading, or the account has no 原创声明 eligibility (so XHS hides the option entirely).","commonSituations":"New accounts or accounts without originality permission where XHS hides the switch; the settings section rendered inside a collapsed panel; XHS redesign renaming the toggle element; clicking too early before the form bottom rendered.","solutions":["Only call setOriginal when the option is expected to exist, or tolerate this error in the caller (log a warning, continue publishing without the declaration)","Open any collapsed '更多设置/高级选项' panel before searching for the toggle","Wait for the settings section to render before querying the toggle","Re-inspect the current XHS publish DOM and update the toggle selector if it changed"],"exampleFix":"// before\nreturn errors.New(\"未找到原创声明选项\")\n// after\nreturn errors.New(\"未找到原创声明选项\") // caller:\nif err := setOriginal(page); err != nil {\n\tslog.Warn(\"设置原创声明失败，跳过\", \"error\", err) // 不阻断发布\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := setOriginal(page); err != nil {\n\tif strings.Contains(err.Error(), \"未找到原创声明选项\") {\n\t\tslog.Warn(\"账号可能无原创权限，跳过原创声明\", \"error\", err)\n\t\treturn nil // 不阻断发布流程\n\t}\n\treturn err\n}","preventionTips":["Only request original declaration for accounts that have 原创权限","Open collapsed '更多设置' panels before searching for the toggle","Wait for the bottom settings section to render before querying","Log and continue instead of failing the whole publish for an optional toggle"],"tags":["dom","ui-toggle","original-declaration","xiaohongshu"],"backgroundTag":"toggle-option-not-found","analyzedSha":"332d196854a9eac0d2b8c2c0e3d0cc43139d724c","analyzedAt":"2026-09-05T22:22:55.988Z","contentChangedAt":"2026-09-05T22:22:55.988Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}