jackwener/OpenCLI · error · CommandExecutionError

weibo user-posts did not observe a valid posts list

Error message

weibo user-posts did not observe a valid posts list

What it means

After payload validation, the CLI distinguishes two empty cases. If the extractor reports it never observed a valid posts list container (sawList is false) and no rows were extracted, it cannot distinguish 'no posts' from 'wrong page', so this CommandExecutionError is thrown instead of returning empty results.

Source

Thrown at clis/weibo/user-posts.js:210

          }

          if (list.length < 10) break;
        }

        return [uid, rows, sawList, sawPostCandidates];
      })()
    `);

        const payload = unwrapEvaluateResult(evaluateResult);
        if (payload && !Array.isArray(payload) && typeof payload === 'object' && 'error' in payload) {
            mapError(payload.error);
        }
        if (!Array.isArray(payload) || payload.length !== 4 || !Array.isArray(payload[1])) {
            throw new CommandExecutionError('weibo user-posts returned malformed extraction payload');
        }
        const [resolvedUid, rows, sawList, sawPostCandidates] = payload;
        if (!sawList && rows.length === 0) {
            throw new CommandExecutionError('weibo user-posts did not observe a valid posts list');
        }
        if (sawPostCandidates && rows.length === 0) {
            throw new CommandExecutionError('weibo user-posts found post candidates but could not extract valid rows');
        }
        if (rows.length === 0) {
            throw new EmptyResultError('weibo user-posts', 'No Weibo posts found for this user/date range');
        }

        return rows.slice(0, limit).map((row, index) => ({
            rank: index + 1,
            id: String(row.id),
            mblogid: row.mblogid || '',
            author: row.author || '',
            uid: String(row.uid || resolvedUid || ''),
            text: row.text || '',
            time: row.time || '',
            reposts: row.reposts ?? 0,
            comments: row.comments ?? 0,

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Verify the user id/uid is correct and the profile page loads in a normal browser.
  2. Refresh session cookies and retry (login walls lack the posts list).
  3. Retry later if Weibo is serving an anti-crawler page; slow down request rates.
  4. Ensure the page fully loads before extraction (stable network, no blocking proxies).
Defensive patterns

Strategy: validation

Validate before calling

const res = await fetch(`https://weibo.com/u/${uid}`);
if (!res.ok || res.url.includes('login') || res.url.includes('verify')) {
  throw new Error('profile not publicly reachable; refresh session or check uid');
}

Type guard

function looksLoggedOut(pageUrl) {
  return /login|passport|verify/i.test(String(pageUrl));
}

Try / catch

try {
  const rows = await runUserPosts({ id: uid, start, end });
} catch (err) {
  if (err instanceof CommandExecutionError && /did not observe a valid posts list/.test(err.message)) {
    // check uid, refresh cookies, or retry later
  } else throw err;
}

Prevention

When it happens

Trigger: Extraction runs against a page without the expected Weibo posts list — redirected to login/verify, wrong profile URL, deleted or renamed user page, or a page that failed to render the list before the script ran.

Common situations: Expired session showing the login wall, uid that no longer exists, network truncating page load, or Weibo serving an anti-bot interstitial.

Related errors


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/1a7091e789fa9460. Report an issue: GitHub.