{"record":{"id":"57bdde12cdbcbc67","repo":"xpzouying/xiaohongshu-mcp","slug":"error-57bdde","errorCode":null,"errorMessage":"设置可见范围失败","messagePattern":"设置可见范围失败","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"xiaohongshu/publish_video.go","lineNumber":142,"sourceCode":"\t\treturn err\n\t}\n\tif err := inputTags(ctx, contentElem, tags); err != nil {\n\t\treturn err\n\t}\n\n\thumanize.Delay(ctx, humanize.AfterType)\n\n\t// 处理定时发布\n\tif scheduleTime != nil {\n\t\tif err := setSchedulePublish(ctx, page, *scheduleTime); err != nil {\n\t\t\treturn errors.Wrap(err, \"设置定时发布失败\")\n\t\t}\n\t\tslog.Info(\"定时发布设置完成\", \"schedule_time\", scheduleTime.Format(\"2006-01-02 15:04\"))\n\t}\n\n\t// 设置可见范围\n\tif err := setVisibility(page, visibility); err != nil {\n\t\treturn errors.Wrap(err, \"设置可见范围失败\")\n\t}\n\n\t// 绑定商品\n\tif err := bindProducts(ctx, page, products); err != nil {\n\t\treturn errors.Wrap(err, \"绑定商品失败\")\n\t}\n\n\tif err := clickPublishButton(page); err != nil {\n\t\treturn err\n\t}\n\n\t// 校验发布真的成功（成功跳转离开发布页），未跳转判失败——消除假成功\n\treturn waitPublishSuccess(page, 15*time.Second)\n}\n","sourceCodeStart":124,"sourceCodeEnd":157,"githubUrl":"https://github.com/xpzouying/xiaohongshu-mcp/blob/332d196854a9eac0d2b8c2c0e3d0cc43139d724c/xiaohongshu/publish_video.go#L124-L157","documentation":"setVisibility switches the publish form's visibility (公开可见/仅自己可见/仅互关好友可见). A failure is wrapped as \"设置可见范围失败\" — the visibility control could not be found or clicked. An empty/unknown visibility string can also make the matching option lookup fail.","triggerScenarios":"setVisibility(page, visibility) fails because the visibility dropdown/option selector does not match current markup, the label string is not one of the three exact supported values, or the control is hidden until some other step completes.","commonSituations":"Passing an unexpected value like \"public\" or \"private\" instead of the exact Chinese labels; frontend update renaming the option elements; dropdown rendered but option list not open when clicked.","solutions":["Pass exactly one of the supported strings: \"公开可见\", \"仅自己可见\", \"仅互关好友可见\" (empty defaults to 公开可见)","Inspect the live page and update the visibility selectors in setVisibility","Add a wait for the visibility control to be visible/clickable before interacting","Omit Visibility (empty string) if the default public scope is acceptable"],"exampleFix":"// before\naction.PublishVideo(ctx, PublishVideoContent{Visibility: \"private\"})\n// after\naction.PublishVideo(ctx, PublishVideoContent{Visibility: \"仅自己可见\"})","handlingStrategy":"validation","validationCode":"var allowed = map[string]bool{\"\": true, \"公开可见\": true, \"仅自己可见\": true, \"仅互关好友可见\": true}\nif !allowed[visibility] {\n    return fmt.Errorf(\"unsupported visibility %q\", visibility)\n}","typeGuard":null,"tryCatchPattern":"if err := setVisibility(page, visibility); err != nil {\n    log.Printf(\"visibility setup failed: %+v, continuing with default\", err)\n    // proceed or return wrapped — choose explicitly\n}","preventionTips":["Only pass the exact supported Chinese label strings","Leave Visibility empty to accept the default 公开可见","Wait for the dropdown to be open before selecting an option","Re-verify selectors after site updates"],"tags":["browser-automation","go","selector","validation"],"backgroundTag":"selector-mismatch","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"}