jackwener/OpenCLI · error · CommandExecutionError

Failed to parse Jike post data: ${data.message || 'unknown e

Error message

Failed to parse Jike post data: ${data.message || 'unknown error'}

What it means

When the loader finds the Jike post's embedded data script but JSON.parse (or equivalent extraction) throws, it reports reason 'parse-error' with the underlying message, and the CLI wraps it in CommandExecutionError with that message.

Source

Thrown at clis/jike/post.js:68

  } catch (e) {
    return { ok: false, reason: 'parse-error', message: e?.message || String(e) };
  }
})()
`);
        if (Array.isArray(data)) {
            return data.map((item) => ({
                type: item.type ?? '',
                author: item.author ?? '',
                content: item.content ?? '',
                likes: item.likes ?? 0,
                time: item.time ?? '',
            }));
        }
        if (data?.reason === 'missing-data-script') {
            throw new CommandExecutionError('Jike post page did not expose the expected data script');
        }
        if (data?.reason === 'parse-error') {
            throw new CommandExecutionError(`Failed to parse Jike post data: ${data.message || 'unknown error'}`);
        }
        throw new CommandExecutionError('Jike post returned an unreadable payload');
    },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Save the raw HTML and inspect the script content around the parse error position
  2. Retry — truncation is often transient (network/CDN)
  3. Update the CLI for a more tolerant parser if Jike changed serialization
  4. Bypass proxies/VPN that might alter the response body
Defensive patterns

Strategy: retry

Try / catch

try {
  await cli('jike', 'post', [postUrl]).run();
} catch (e) {
  if (String(e.message).startsWith('Failed to parse Jike post data:')) {
    await sleep(1000); // truncation is often transient
    // retry once, then capture raw HTML for diagnosis
  } else throw e;
}

Prevention

When it happens

Trigger: The embedded data script exists but its content is not valid JSON or not parseable by the extraction logic — truncated HTML, escaped-character issues, script content served as JSON5 or JS rather than pure JSON.

Common situations: Proxy/CDN truncating the HTML response; Jike changing the script's serialization format; character-encoding issues (non-UTF8 responses); anti-bot rewrites mangling the payload.

Understand the failure class

Background: JSON parse error: "Unexpected token" / "not valid JSON" / "failed to parse" — what JSON parsers are really complaining about — this error's family across 45 libraries.

Related errors


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