Summary
The notion pages markdown insert command appears to be broken in the current CLI build / API path.
In a real usage flow, insert fails with a validation-style error:
body.insert_content.content should be defined
Under the same environment and against the same target page, notion pages markdown replace succeeds and the content is written correctly.
This suggests the issue is likely in the CLI request body construction for the insert operation rather than workspace auth, page targeting, or markdown content itself.
Environment
- Repo:
Gladium-AI/neo-notion-cli
- CLI version:
v0.1.2
- Build commit:
534dc98
- CLI binary path:
/home/paolo/.local/bin/notion
- Observed API version in docs/help:
2026-03-11
- OS: Linux amd64
- Runtime context where issue was observed: production-like real workflow writing to an existing Notion page
What I was trying to do
Populate an already-created Notion page body with markdown content.
The intended safe flow was:
- verify the page exists
- confirm current markdown/body state
- use
pages markdown insert to add content
- verify by reading the page back
Actual behavior
pages markdown insert fails immediately with:
body.insert_content.content should be defined
Expected behavior
pages markdown insert should accept markdown content and append/insert it into the target page body successfully.
At minimum, if the input flag shape is wrong, the CLI should:
- map the provided content into the correct request field, or
- return a more actionable CLI-layer error before making the API call.
Strong indicator that this is specific to insert
Using the same page and same overall workflow:
notion pages markdown insert ... -> fails
notion pages markdown replace ... --allow-deleting-content -> succeeds
- reading the page back after
replace confirms the content is present
So:
- auth was valid
- page ID was valid
- target page was writable
- markdown content itself was acceptable enough for the page write path
Likely root cause
The error message strongly suggests the CLI is sending a malformed or incomplete request body for the insert endpoint.
Specifically, it looks like the API expects something under a nested field like:
{
"insert_content": {
"content": "..."
}
}
but the CLI may be doing one of the following instead:
- omitting
insert_content.content
- mapping the CLI flag to the wrong JSON path
- using a stale request schema / old field name
- incorrectly serializing markdown insert payloads for the current API version
Reproduction notes
I observed this in a real page-write workflow rather than a synthetic isolated test, but the behavior should be straightforward to reproduce with:
- create or locate an editable page
- run a markdown insert command against it
- observe the validation error
- run markdown replace against the same page
- observe successful write
Representative command shape used:
notion pages markdown insert --page-id <page-id> --new-str 'Some markdown content'
Representative successful comparison command:
notion pages markdown replace --page-id <page-id> --new-str 'Some markdown content' --allow-deleting-content
Why this matters
This is more than a cosmetic bug:
insert is the safer operation for many agent and automation workflows
replace is destructive by nature and requires stronger safeguards
- if users have to fall back to
replace, they risk wiping page content accidentally
- this makes the CLI less reliable for incremental page editing, which is a common and important workflow
For agent-oriented usage specifically, this breaks the preferred safe mutation path:
- inspect -> insert/append -> verify
and forces a downgrade to:
- inspect -> replace -> verify
which is inherently riskier.
Suggested fix
Please inspect the implementation of pages markdown insert and compare it directly with the request builder for pages markdown replace.
Things worth checking:
- Flag to request-body mapping
- confirm
--new-str (or equivalent input) is being mapped into the exact field expected by the insert endpoint
- Current API schema alignment
- verify the insert endpoint payload still matches the current Notion API version used by the CLI
- Nil / empty content handling
- ensure the CLI is not constructing an empty nested object or dropping content during normalization / request assembly
- Parity tests
- add tests that validate both
insert and replace against expected outbound payloads
- Error surfacing
- if the payload cannot be built, emit a clearer CLI-side error than the downstream validation message
Suggested regression tests
A good regression suite would include:
1. Insert builds expected request body
Given:
notion pages markdown insert --page-id test-page --new-str 'Hello'
Assert that the outbound request contains the required nested content field expected by the API.
2. Insert and replace accept the same markdown input source
If replace works with --new-str, insert should support equivalent content input semantics unless explicitly documented otherwise.
3. Helpful error on empty content
If empty strings are disallowed, return a CLI validation error such as:
markdown insert content is empty
instead of sending an invalid body to the API.
Current workaround
Use:
notion pages markdown replace --page-id <page-id> --new-str '...' --allow-deleting-content
This works, but it is only a workaround and is not a safe substitute for insert in incremental-edit workflows.
Recommendation for docs until fixed
If this cannot be fixed immediately, it may be worth adding a temporary note in the README/help text that:
pages markdown insert is currently unreliable / under investigation
pages markdown replace is the current workaround
- users should exercise caution because
replace is destructive
Additional note
The bug was discovered during a real Notion page population workflow where a page body had to be filled after creation. The page was initially empty, a minimal write was tested, and replace consistently succeeded while insert consistently failed. That pattern makes this look highly likely to be an endpoint-specific CLI bug rather than user error.
Summary
The
notion pages markdown insertcommand appears to be broken in the current CLI build / API path.In a real usage flow,
insertfails with a validation-style error:Under the same environment and against the same target page,
notion pages markdown replacesucceeds and the content is written correctly.This suggests the issue is likely in the CLI request body construction for the
insertoperation rather than workspace auth, page targeting, or markdown content itself.Environment
Gladium-AI/neo-notion-cliv0.1.2534dc98/home/paolo/.local/bin/notion2026-03-11What I was trying to do
Populate an already-created Notion page body with markdown content.
The intended safe flow was:
pages markdown insertto add contentActual behavior
pages markdown insertfails immediately with:Expected behavior
pages markdown insertshould accept markdown content and append/insert it into the target page body successfully.At minimum, if the input flag shape is wrong, the CLI should:
Strong indicator that this is specific to
insertUsing the same page and same overall workflow:
notion pages markdown insert ...-> failsnotion pages markdown replace ... --allow-deleting-content-> succeedsreplaceconfirms the content is presentSo:
Likely root cause
The error message strongly suggests the CLI is sending a malformed or incomplete request body for the insert endpoint.
Specifically, it looks like the API expects something under a nested field like:
{ "insert_content": { "content": "..." } }but the CLI may be doing one of the following instead:
insert_content.contentReproduction notes
I observed this in a real page-write workflow rather than a synthetic isolated test, but the behavior should be straightforward to reproduce with:
Representative command shape used:
Representative successful comparison command:
Why this matters
This is more than a cosmetic bug:
insertis the safer operation for many agent and automation workflowsreplaceis destructive by nature and requires stronger safeguardsreplace, they risk wiping page content accidentallyFor agent-oriented usage specifically, this breaks the preferred safe mutation path:
and forces a downgrade to:
which is inherently riskier.
Suggested fix
Please inspect the implementation of
pages markdown insertand compare it directly with the request builder forpages markdown replace.Things worth checking:
--new-str(or equivalent input) is being mapped into the exact field expected by the insert endpointinsertandreplaceagainst expected outbound payloadsSuggested regression tests
A good regression suite would include:
1. Insert builds expected request body
Given:
notion pages markdown insert --page-id test-page --new-str 'Hello'Assert that the outbound request contains the required nested content field expected by the API.
2. Insert and replace accept the same markdown input source
If
replaceworks with--new-str,insertshould support equivalent content input semantics unless explicitly documented otherwise.3. Helpful error on empty content
If empty strings are disallowed, return a CLI validation error such as:
instead of sending an invalid body to the API.
Current workaround
Use:
This works, but it is only a workaround and is not a safe substitute for insert in incremental-edit workflows.
Recommendation for docs until fixed
If this cannot be fixed immediately, it may be worth adding a temporary note in the README/help text that:
pages markdown insertis currently unreliable / under investigationpages markdown replaceis the current workaroundreplaceis destructiveAdditional note
The bug was discovered during a real Notion page population workflow where a page body had to be filled after creation. The page was initially empty, a minimal write was tested, and
replaceconsistently succeeded whileinsertconsistently failed. That pattern makes this look highly likely to be an endpoint-specific CLI bug rather than user error.