jackwener/OpenCLI · warning · EmptyResultError

weibo user-posts

Error message

weibo user-posts

What it means

This is the well-formed empty case: the payload is valid, a posts list was observed and no post candidates were seen, but zero valid rows were extracted. The CLI throws EmptyResultError('weibo user-posts', 'No Weibo posts found for this user/date range') to signal the user simply has no posts matching the query, e.g. no posts within the requested start/end window.

Source

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

      })()
    `);

        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,
            likes: row.likes ?? 0,
            pic_count: row.pic_count ?? 0,
            url: row.url || '',
        }));
    },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Widen the start/end date range and retry.
  2. Confirm the account actually posted in the window by checking the profile in a browser.
  3. Verify the uid corresponds to the intended account (similar numeric ids are easy to mistype).
  4. Remember dates are interpreted in Asia/Shanghai (+08:00); shift your range if you computed boundaries in another time zone.

Example fix

// before
--start 2024-03-01 --end 2024-03-02   // no posts in window
// after
--start 2024-01-01 --end 2024-03-31   // widened window
Defensive patterns

Strategy: fallback

Validate before calling

if (start && end && start > end) throw new Error('inverted range');
if (start && end && (Date.parse(end) - Date.parse(start)) / 86400000 > 366) {
  console.warn('range exceeds one year; consider chunking');
}

Try / catch

try {
  return await runUserPosts(opts);
} catch (err) {
  if (err instanceof EmptyResultError) {
    return []; // treat as legitimate 'no posts in range'
  }
  throw err;
}

Prevention

When it happens

Trigger: Querying a user who posted nothing in the given date range, a range entirely before the account's first post or after its last, an overly restrictive limit/filter, or a user whose posts are all hidden/deleted.

Common situations: Narrow date windows around inactive periods, querying archived/suspended accounts, or time-zone off-by-one where the Shanghai date window excludes expected posts.

Understand the failure class

Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.

Related errors


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