{"record":{"id":"ccee50c4fb6ab069","repo":"xpzouying/xiaohongshu-mcp","slug":"error-ccee50","errorCode":null,"errorMessage":"设置定时发布失败","messagePattern":"设置定时发布失败","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"xiaohongshu/publish_video.go","lineNumber":135,"sourceCode":"\tif err != nil {\n\t\treturn err\n\t}\n\tif err := humanize.Type(ctx, contentElem, content); err != nil {\n\t\treturn errors.Wrap(err, \"输入正文失败\")\n\t}\n\tif err := waitAndClickTitleInput(titleElem); err != nil {\n\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","sourceCodeStart":117,"sourceCodeEnd":153,"githubUrl":"https://github.com/xpzouying/xiaohongshu-mcp/blob/332d196854a9eac0d2b8c2c0e3d0cc43139d724c/xiaohongshu/publish_video.go#L117-L153","documentation":"When ScheduleTime is non-nil, submitPublishVideo calls setSchedulePublish to switch the publish form into scheduled mode and pick the date/time. Any failure is wrapped as \"设置定时发布失败\". It means the schedule UI could not be operated — the toggle/date-picker interaction failed.","triggerScenarios":"setSchedulePublish fails because the 定时发布 toggle selector changed, the calendar popup did not render, or the requested time is outside the allowed window (e.g. platform limits scheduling to within a certain future range or minimum lead time).","commonSituations":"Scheduling a time too close to now or beyond the platform max horizon; site update changing the date-picker DOM; popup rendered inside an iframe/portal the selector does not search; slow render timing out the interaction.","solutions":["Validate the schedule time is in the platform's allowed window (not in the past, not beyond the max horizon, adequate lead time) before calling","Re-run with a longer timeout so the date picker has time to render","Inspect current markup and update the schedule toggle / picker selectors","As a workaround, publish immediately (ScheduleTime=nil) and repost later"],"exampleFix":"// before\nschedule := time.Now().Add(30 * time.Second)\naction.PublishVideo(ctx, PublishVideoContent{ScheduleTime: &schedule})\n// after\nschedule := time.Now().Add(2 * time.Hour) // well inside the allowed window\naction.PublishVideo(ctx, PublishVideoContent{ScheduleTime: &schedule})","handlingStrategy":"validation","validationCode":"now := time.Now()\nif scheduleTime != nil && (scheduleTime.Before(now.Add(1*time.Hour)) || scheduleTime.After(now.Add(14*24*time.Hour))) {\n    return errors.New(\"schedule time outside allowed window\")\n}","typeGuard":null,"tryCatchPattern":"if err := setSchedulePublish(ctx, page, *scheduleTime); err != nil {\n    log.Printf(\"schedule failed (%+v), falling back to immediate publish\", err)\n    return submitPublishVideo(ctx, page, title, content, tags, nil, visibility, products)\n}","preventionTips":["Schedule at least ~1–2 hours in the future, within the platform's max horizon","Wait for the date picker to render before interacting","Keep selectors updated against the live site","Fall back to immediate publish if scheduling is optional"],"tags":["browser-automation","go","scheduling","selector"],"backgroundTag":"schedule-publish-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"}