jackwener/OpenCLI · error · CommandExecutionError
xiaohongshu/unfollow: expected Xiaohongshu profile host, got
Error message
xiaohongshu/unfollow: expected Xiaohongshu profile host, got ${parsedHref.hostname} What it means
After navigation, the command verifies the browser actually landed on an https://*.xiaohongshu.com page. If the final URL's protocol is not https or the hostname is not a xiaohongshu.com domain (e.g. a redirect to a login gateway, carrier captive portal, or anti-bot interstitial), this CommandExecutionError naming the offending hostname is thrown.
Source
Thrown at clis/xiaohongshu/unfollow.js:215
],
columns: ['status', 'user_id', 'url'],
func: async (page, kwargs) => {
if (!page) {
throw new CommandExecutionError('Browser session required for xiaohongshu unfollow');
}
try {
const userId = assertUserId(kwargs['user-id']);
const url = `https://www.xiaohongshu.com/user/profile/${userId}`;
await page.goto(url);
await page.wait({ time: PROFILE_SETTLE_MS / 1000 });
const hrefRaw = unwrapEvaluateResult(await page.evaluate('() => location.href'));
if (typeof hrefRaw !== 'string') {
throw new CommandExecutionError('xiaohongshu/unfollow: malformed current-url payload');
}
const parsedHref = new URL(hrefRaw);
if (parsedHref.protocol !== 'https:' || !isXiaohongshuHost(parsedHref.hostname)) {
throw new CommandExecutionError(
`xiaohongshu/unfollow: expected Xiaohongshu profile host, got ${parsedHref.hostname}`,
);
}
if (/\/login(?:[/?#]|$)/i.test(parsedHref.pathname)) {
throw new AuthRequiredError('www.xiaohongshu.com');
}
const currentProfile = parsedHref.pathname.match(/^\/user\/profile\/([a-zA-Z0-9]{8,32})\/?$/);
if (currentProfile?.[1] !== userId) {
throw new CommandExecutionError(
`xiaohongshu/unfollow: expected profile ${userId}, got ${parsedHref.pathname}`,
);
}
// Step 1: click 已关注 (idempotent — bails out if 关注 is visible)
const clickResult = requireActionResult(
await page.evaluate(buildClickUnfollowScript()),
'click-unfollow',
);View on GitHub (pinned to 49907e53dc)
Solutions
- Check the reported hostname in the message and resolve www.xiaohongshu.com from the same machine (nslookup/ping) to detect DNS hijack or proxy rewriting
- Disable/fix VPN, proxy, or hosts-file entries that rewrite xiaohongshu.com and retry
- Open the profile URL manually in the automated Chrome and complete any risk-control/verification challenge, then re-run
- Retry from a different network if your current network intercepts the domain
Example fix
// hosts file before 203.0.113.9 www.xiaohongshu.com // after (remove the override, use real DNS) # entry removed
Defensive patterns
Strategy: try-catch
Validate before calling
// pre-check DNS on your machine
const { addresses } = await dns.promises.lookup('www.xiaohongshu.com');
if (!addresses.length) throw new Error('www.xiaohongshu.com does not resolve — check proxy/hosts'); Try / catch
try { await cli.unfollow({ 'user-id': id }); } catch (e) { if (/expected Xiaohongshu profile host/.test(String(e.message))) { /* disable VPN/proxy, fix hosts/DNS, or complete the challenge then retry */ } else throw e; } Prevention
- Avoid VPNs/proxies that rewrite or intercept xiaohongshu.com
- Keep the hosts file free of domain overrides
- Run from networks without DNS pollution, or use trusted DNS (DoH)
- Complete any anti-bot challenge in the automated browser before running
When it happens
Trigger: The site redirected off-domain (e.g. to a risk-control or verification page on another host); DNS hijacking or corporate proxy rewriting the domain; a hosts-file override pointing www.xiaohongshu.com elsewhere; the browser resolving to a mirror or an error page whose hostname differs.
Common situations: Running from a network with a transparent proxy/VPN that intercepts xiaohongshu.com; DNS pollution (common on some networks/regions) redirecting the domain; anti-bot challenge redirecting to a third-party captcha host; mistyped proxy config in the browser profile.
Related errors
- archive wayback request failed: ${error?.message || error}
- Failed to fetch Chess.com API ${url}: ${error?.message || er
- coingecko exchanges request failed: ${err?.message ?? err}
- coingecko global request failed: ${err?.message ?? err}
- coingecko top request failed: ${error?.message || error}
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/7f1ac1348d7bccea.
Report an issue: GitHub.