{"record":{"id":"08a0d604b7959bd8","repo":"xpzouying/xiaohongshu-mcp","slug":"error-08a0d6","errorCode":null,"errorMessage":"小红书发布失败","messagePattern":"小红书发布失败","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"xiaohongshu/publish.go","lineNumber":94,"sourceCode":"\t}\n\n\t// 重设超时：.Context(ctx) 会替换掉 NewPublishImageAction 里 Timeout(300s) 的 deadline\n\tpage := p.page.Context(ctx).Timeout(300 * time.Second)\n\n\tif err := uploadImages(page, content.ImagePaths); err != nil {\n\t\treturn errors.Wrap(err, \"小红书上传图片失败\")\n\t}\n\n\ttags := content.Tags\n\tif len(tags) >= 10 {\n\t\tlogrus.Warnf(\"标签数量超过10，截取前10个标签\")\n\t\ttags = tags[:10]\n\t}\n\n\tlogrus.Infof(\"发布内容: title=%s, images=%v, tags=%v, schedule=%v, original=%v, visibility=%s, products=%v\", content.Title, len(content.ImagePaths), tags, content.ScheduleTime, content.IsOriginal, content.Visibility, content.Products)\n\n\tif err := submitPublish(ctx, page, content.Title, content.Content, tags, content.ScheduleTime, content.IsOriginal, content.Visibility, content.Products); err != nil {\n\t\treturn errors.Wrap(err, \"小红书发布失败\")\n\t}\n\n\treturn nil\n}\n\n// hasPopCover 当前页面是否还有挡人的浮层。\nfunc hasPopCover(page *rod.Page) bool {\n\thas, _, err := page.Has(\"div.d-popover\")\n\treturn err == nil && has\n}\n\n// dismissPopCover 关掉挡住发布 TAB 的浮层，按 Esc → 点空白 → 摘节点逐级降级。\n// 保留摘节点这一步是因为它只要节点还在就必定生效，前两步是否奏效取决于页面\n// 自己有没有写对应的处理，无从预判。\nfunc dismissPopCover(page *rod.Page) {\n\tif err := page.Keyboard.Press(input.Escape); err != nil {\n\t\tlogrus.Debugf(\"按 Esc 关闭浮层失败: %v\", err)\n\t}","sourceCodeStart":76,"sourceCodeEnd":112,"githubUrl":"https://github.com/xpzouying/xiaohongshu-mcp/blob/332d196854a9eac0d2b8c2c0e3d0cc43139d724c/xiaohongshu/publish.go#L76-L112","documentation":"Publish 图文发布流程的总包装错误：上传图片或 submitPublish 任一子步骤失败时被 errors.Wrap 上抛到此消息。真正原因在包装链下游（如上传输入框查找失败、TAB 点击失败、长度超限等），需查看错误链的底层 cause。","triggerScenarios":"Thrown at xiaohongshu/publish.go:94 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["查看错误链底层 cause 定位具体失败步骤","按底层错误对应的方式处理（重试/修正参数/检查登录态）","确认图片路径有效且标签数不超过 10"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}