From c9772db119260a06bf75326f32bf6fc5da1df599 Mon Sep 17 00:00:00 2001 From: Andrew Yim Date: Tue, 14 Apr 2026 23:26:42 +0900 Subject: [PATCH] fix(notion-writer): skip archived blocks when replacing page content The --replace flag failed with "Can't edit block that is archived" when a page contained previously archived blocks. Now skips them during clear. Co-Authored-By: Claude Opus 4.6 (1M context) --- custom-skills/32-notion-writer/code/scripts/notion_writer.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/custom-skills/32-notion-writer/code/scripts/notion_writer.py b/custom-skills/32-notion-writer/code/scripts/notion_writer.py index 4df2b78..0658f1d 100644 --- a/custom-skills/32-notion-writer/code/scripts/notion_writer.py +++ b/custom-skills/32-notion-writer/code/scripts/notion_writer.py @@ -349,8 +349,10 @@ def clear_page_content(notion: Client, page_id: str) -> bool: # Get all child blocks children = notion.blocks.children.list(block_id=formatted_id) - # Delete each block + # Delete each block (skip already archived blocks) for block in children.get('results', []): + if block.get('archived'): + continue notion.blocks.delete(block_id=block['id']) return True