Skip to content

[Bug]: weixin/download crashes on complex tables during Markdown conversion #2154

Description

@nintendomustdie

Summary

opencli weixin download crashes while converting a WeChat article containing many editor-generated tables to Markdown. The article page loads correctly and the adapter extracts the title, author, publish time, content, and images, but downloadArticle() fails during HTML-to-Markdown conversion.

Reproduction

opencli weixin download \
  --url "https://mp.weixin.qq.com/s/1nUI9K0IT8s6NG4sS9rkXw" \
  --output ./weixin-articles

The article is titled 五万字实操手册:以物抵债全方位解读(2026年版). Its #js_content contains 34 tables.

Actual behavior

ok: false
error:
  code: UNKNOWN
  message: Cannot read properties of undefined (reading 'parentNode')
  exitCode: 1

A retained trace shows that navigation completes and the error occurs after article extraction, during the download/conversion stage. The relevant parentNode access is in the GFM table conversion path used by Turndown.

Expected behavior

The command should export the full article as Markdown. A malformed or editor-specific table structure should not crash the entire download. If a table cannot be represented safely as GFM, preserving its text as line-broken Markdown would be preferable to failing the command.

Verified local workaround

I added adapter-side preprocessing immediately before downloadArticle():

  • iterate over tables inside #js_content;
  • preserve each table's innerText as an ordinary paragraph with line breaks;
  • replace the table node before Turndown processes the HTML.

After this change, the same command completed successfully:

status: success
size: 139.4 KB

The resulting Markdown retained the complete article text and downloaded image. This confirms that the failure is triggered by table conversion rather than navigation, authentication, or article extraction.

An upstream fix could either harden the Turndown/GFM table path against detached or malformed rows, or provide safe adapter-specific table normalization while preserving as much structure as possible.

Environment

  • OpenCLI: 1.8.6
  • Extension: 1.0.22
  • Node.js: v22.22.2
  • macOS: 26.5.2
  • Daemon, extension, and connectivity: all OK

Related issue checked

#611 reported a different failure (failed — no title) on OpenCLI 1.5.6 and was closed after a title-extraction fix. This report concerns a reproducible parentNode crash during Markdown table conversion on 1.8.6.

Issue filed after an OpenCLI autofix was verified by a successful retry.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions