jackwener/OpenCLI · error · CommandExecutionError

Failed to parse visible Weibo favorites

Error message

Failed to parse visible Weibo favorites

What it means

clis/weibo/favorites.js:160 throws CommandExecutionError('Failed to parse visible Weibo favorites') when raw cards were found but every one failed parseFavoriteCard/dedupeFavorites, leaving zero unique items. It signals the page had content the parser could not understand, as opposed to a genuinely empty page.

Source

Thrown at clis/weibo/favorites.js:160

          if (rawText.length > 20) out.push({ text: rawText, url: postUrl });
          if (out.length >= ${limit}) break;
        }
        return out;
      })()
    `)), 'weibo favorites');

    if (rawData.length === 0) {
      throw new EmptyResultError('weibo favorites', 'No favorites were visible on the favorites page');
    }

    const items = rawData
      .map(card => parseFavoriteCard(card, favUrl))
      .filter(Boolean);

    const uniqueItems = dedupeFavorites(items, favUrl);
    if (uniqueItems.length === 0) {
      throw new CommandExecutionError('Failed to parse visible Weibo favorites');
    }
    return uniqueItems.slice(0, limit);
  },
});

export const __test__ = {
  parseFavoriteCard,
  parsePositiveInt,
  dedupeFavorites,
};

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Update the CLI to the latest version — this usually means the page markup changed
  2. Open weibo.com/fav in Chrome and inspect the card text to confirm the layout the parser expects
  3. Retry later; if Weibo was mid-deploy the old layout may return
  4. File a bug with a sample card text if the latest version still fails to parse

Example fix

// before: hard failure on redesign
const favs = await cli.run('weibo favorites', { limit });
// after: degrade gracefully
let favs = [];
try { favs = await cli.run('weibo favorites', { limit }); }
catch (e) { console.warn('favorites parse failed; possibly Weibo markup change:', e.message); }
Defensive patterns

Strategy: fallback

Type guard

function isParseFailure(e) { return e instanceof Error && e.message === 'Failed to parse visible Weibo favorites'; }

Try / catch

let favorites = [];
try {
  favorites = await cli.run('weibo favorites', { limit });
} catch (e) {
  if (isParseFailure(e)) {
    console.warn('Weibo favorites page could not be parsed — CLI may need updating; continuing with empty result.');
  } else throw e;
}

Prevention

When it happens

Trigger: rawData is non-empty but each card's text lacks the expected fields (author/time/content lines), so parseFavoriteCard returns falsy for all cards, or dedupeFavorites removes everything because favUrl matching fails.

Common situations: Weibo changing the favorites-page DOM/text layout after an update; cards being ads, headers, or tab elements rather than actual favorite entries; locale/time-format changes breaking the regex heuristics; running an outdated CLI against a redesigned page.

Understand the failure class

Related errors


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