xpzouying/xiaohongshu-mcp · error
设置原创声明失败(已请求原创,中止发布)
Error message
设置原创声明失败(已请求原创,中止发布)
What it means
Raised in submitPublish when the caller explicitly requested isOriginal=true but setOriginal fails to check the original-content declaration on the publish form. The library deliberately aborts instead of silently publishing as non-original, so the user never mistakenly believes the note was declared original.
Source
Thrown at xiaohongshu/publish.go:396
return err
}
slog.Info("检查正文长度:通过")
if scheduleTime != nil {
if err := setSchedulePublish(ctx, page, *scheduleTime); err != nil {
return errors.Wrap(err, "设置定时发布失败")
}
slog.Info("定时发布设置完成", "schedule_time", scheduleTime.Format("2006-01-02 15:04"))
}
if err := setVisibility(page, visibility); err != nil {
return errors.Wrap(err, "设置可见范围失败")
}
// 处理原创声明:显式请求了原创但设置失败 → 报错中止,不静默发成非原创(避免"以为原创其实不是")
if isOriginal {
if err := setOriginal(page); err != nil {
return errors.Wrap(err, "设置原创声明失败(已请求原创,中止发布)")
}
slog.Info("已声明原创")
}
if err := bindProducts(ctx, page, products); err != nil {
return errors.Wrap(err, "绑定商品失败")
}
if err := clickPublishButton(page); err != nil {
return err
}
// 校验发布真的成功:成功后创作平台会跳转离开发布页;未跳转则判定失败,
// 消除"点了发布按钮就算成功"的假阳性。
return waitPublishSuccess(page, 15*time.Second)
}
// waitPublishSuccess 轮询等待发布成功的信号:小红书发布成功后会跳转离开发布表单页View on GitHub (pinned to 332d196854)
Solutions
- Verify the account actually has original-declaration eligibility on the Xiaohongshu creator platform
- If original is optional, call Publish with isOriginal=false
- Retry; transient interactivity failures can resolve
- Inspect the wrapped cause and update selectors if Xiaohongshu changed the DOM
Example fix
// before
err := xhs.Publish(..., isOriginal=true) // fails on ineligible account
// after
if !accountSupportsOriginal {
err := xhs.Publish(..., isOriginal=false)
} else {
err := xhs.Publish(..., isOriginal=true)
} Defensive patterns
Strategy: validation
Validate before calling
// 仅在账号已开通原创声明权限时请求原创
if isOriginal && !accountHasOriginalPrivilege {
isOriginal = false
} Try / catch
if err := xhs.Publish(...); err != nil {
if strings.Contains(err.Error(), "设置原创声明失败") {
// abort publishing or retry with isOriginal=false
}
} Prevention
- Confirm account eligibility for original declaration first
- Make isOriginal explicit, not defaulted true
- Treat this error as fatal-by-design: never silently re-publish as non-original
- Check the wrapped cause before changing selectors
When it happens
Trigger: Calling Publish with isOriginal=true while the original-declaration checkbox/toggle cannot be found, is disabled (e.g. account not eligible for original declaration), or cannot be clicked.
Common situations: Accounts without original-declaration privileges; Xiaohongshu UI change moving the original toggle; the toggle being greyed out for certain content types (e.g. video).
Related errors
AI-assisted analysis of xpzouying/xiaohongshu-mcp@332d196854 (2026-09-05).
Data as JSON: /api/errors/2a169620902576e0.
Report an issue: GitHub.