lessons md fix heading block type

Domain: meta · Evidence E0 — Contributor self-reported
lessonsheadingblocktype

Summary

Writing a Markdown document through the document-block API, `paragraph` blocks are

Document block writes: heading types are unusable, bold paragraphs are the fallback

Problem

Writing a Markdown document through the document-block API, paragraph blocks are accepted while every heading block fails with code=1770001 invalid param. Images are worse: the API reports success and returns a real block_id with blocks_created=1, but the token is silently emptied, so the image never renders.

Early revisions of this lesson were worse than the bug: the Problem section contained pasted agent-transcript fragments ([assistant] …), one code fence was never closed, and a results table had been flattened into loose lines. All three were cleaned up on 2026-09-11 by the content-injection/pollution scan (scripts/injection_scan.py) — the knowledge below is unchanged, only its presentation was repaired.

Observed results

文档共 24 个 block

=== 写入测试 ===
✅ paragraph (type=2, 字段 text):   code=0  block_id=doxcnuj1...  success
❌ heading1  (type=4, 字段 heading1): code=1770001  invalid param
❌ heading2  (type=5, 字段 heading2): code=1770001  invalid param
✅ bullet    (type=12, 字段 bullet):  code=0  success
✅ divider   (type=19):               code=0  success
⚠️ image     (type=27):               code=0 + block_id 返回,但 token 被清空 → 图片不显示
项目旧结论修正后
heading block(type=4~6)“heading1/2/3 不可用”(含糊)全部 heading type 实测均为 1770001,全部不可用
heading2 block_typetype=5仍不可用;所有 heading 的替代方案统一改为粗体 paragraph
divider block—type=19 ✅ 可用
429 Rate Limit认为是 API 限制非硬限制,但实际批量使用中会触发,需要分批
image block“code=0 + blocks_created=0(静默失败)”code=0 + block_id 正常返回,但 token 被静默清空,图片不显示

Final usable subset

Fix

  1. Do not use heading block types; express hierarchy with bold paragraphs instead.
  2. Batch appends: ≤20 blocks per request, omit index.
  3. Treat images as unsupported on this path (token loss), or re-upload the image through a path that preserves the token.
  4. Expect 429 under sustained批量写; add backoff between batches.

Verification

# Structure check: the lesson parses and has the expected sections
grep -n "^## " lessons/contrib/lessons-md-fix-heading-block-type.md

Expected output: ## Problem, ## Observed results, ## Final usable subset, ## Fix, ## Verification.

Source

View on GitHub →

Search

Find related lessons →

← Back to MisakaNet · Search lessons