jackwener/OpenCLI · error · CommandExecutionError

weibo user-posts returned malformed extraction payload

Error message

weibo user-posts returned malformed extraction payload

What it means

The command expects the in-page extraction script to return a payload of exactly [resolvedUid, rows, sawList, sawPostCandidates] — a 4-element array whose second element is an array. If the evaluate result is anything else (non-array, wrong arity, rows not an array), the payload is considered malformed and this CommandExecutionError is thrown, indicating the page script and the CLI contract are out of sync or the extractor did not run as expected.

Source

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

              likes: post.attitudes_count ?? 0,
              pic_count: post.pic_num ?? Object.keys(post.pic_infos || {}).length,
              url: 'https://weibo.com/' + (user.id || uid) + '/' + mblogid,
            });
          }

          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 || ''),

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Retry the command to rule out a transient page-load problem.
  2. Refresh cookies/re-login and retry, since interstitial pages can break the extractor.
  3. Check for a newer version of the CLI that supports the current Weibo page structure.
  4. If reproducible, capture the page HTML at failure time and compare against the extractor's expected selectors.
Defensive patterns

Strategy: try-catch

Type guard

function isWellFormedPayload(p) {
  return Array.isArray(p) && p.length === 4 && Array.isArray(p[1]);
}

Try / catch

try {
  const rows = await runUserPosts(opts);
} catch (err) {
  if (err instanceof CommandExecutionError && /malformed extraction payload/.test(err.message)) {
    // page script contract broken: retry, refresh session, or update CLI
  } else throw err;
}

Prevention

When it happens

Trigger: The evaluated script returns null/undefined, an object without an 'error' key, an array of length other than 4, or a 4-element array whose rows slot is not an array.

Common situations: Weibo page redesign so the injected script errors and returns a different value, page redirecting to a verification/login interstitial mid-evaluation, or the extractor being blocked by page CSP.

Understand the failure class

Related errors


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