Skip to content

examples: the official-SDK Notion script exits 1 at a database search that Notion-Version 2025-09-03 refuses #1157

Closed

Description

@nuriyoo

Found while measuring for #1156.

What you ran — the Notion script of the official-SDK examples, on main at 08f22dc0, with notion-client 3.1.0, which sends Notion-Version: 2025-09-03:

python examples/using-official-sdk/notion.py

What happened — it reads the page, its blocks and its comment, then exits 1 at the search that lists databases, notion.search(filter={"property": "object", "value": "database"}):

notion_client.errors.APIResponseError: body failed validation. Fix one:
body.filter.value should be `"page"` or `"data_source"`, instead was `"database"`.
body.filter.in_trash should be defined, instead was `undefined`.

That refusal is real Notion's, word for word. The same body sent to api.notion.com on 2026-10-30 (UTC):

Notion-Version filter.value api.notion.com
2025-09-03 database 400 validation_error, the message above
2025-09-03 data_source 200, three data_source objects, none with a data_sources member
2022-06-28 database 200, three database objects, none with a data_sources member

Backlot has answered this way since 348e139c, which is #880: the script exits 0 on its parent d424a269 and 1 on 348e139c. CI runs the Linear example and none of the Python ones, so no run caught it.

What you expected instead — exit 0, printing the database's row as the script did on d424a269: database 'Eng Tasks' → 1 row(s): and - Fix gateway 502s [In Progress].

Where you ran it — main at 08f22dc0, Python 3.14.4, macOS 27.0, uv sync --all-extras --locked, notion-client 3.1.0.

What a fix has to settle — the script changes, not Backlot. Changing the filter's value alone is not enough: the next line reads db["data_sources"][0]["id"], a member none of the search results in the table has. Searching for data_source and querying the first result by its own id, notion.data_sources.query(data_source_id=ds["id"]), exits 0 on main and prints data source 'Eng Tasks' → 1 row(s): with the same row. The comment above the search, # list databases via a type-filtered search, then query one for its rows, would name data sources.

Activity

  1. added
    bugBacklot is wrong by its own spec: a crash, a failed import, an answer the corpus does not license
    exampleThe runnable scripts under examples/, or a change that alters what one of them does or prints
    on Oct 30, 2026
  2. reyhaan07 commented on Oct 30, 2026

    @reyhaan07
    Contributor

    I'd like to take this one.

  3. nuriyoo commented on Oct 31, 2026

    @nuriyoo
    ContributorAuthor

    @reyhaan07 go ahead. No need to wait for an assignment: open a PR against the latest main with Closes #1157 in its description, and the linked PR is what marks the issue as taken.

    It still reproduces on main at 17daef4f with notion-client 3.1.0. With the change under What a fix has to settle (a data_source filter, notion.data_sources.query(data_source_id=ds["id"]), and the title read from ds), the script exits 0 there and prints data source 'Eng Tasks' → 1 row(s): and - Fix gateway 502s [In Progress]. A few things for the PR:

    • The change is examples/using-official-sdk/notion.py alone, the comment above the search included. Backlot's refusal is real Notion's (the table in the issue), so nothing under backlot/ changes.
    • No test or CI job runs this script, so the template's first checkbox can stay [ ] with that reason on the same line. Under Verification, show the script's output on main and on your branch.
    • For the title, one sentence on what the script does once it is merged, starting with this issue's examples: prefix (item 5 of Pull requests in CONTRIBUTING.md).
  4. removed
    bugBacklot is wrong by its own spec: a crash, a failed import, an answer the corpus does not license
    on Oct 31, 2026
  5. added a commit that references this issue on Nov 1, 2026
    a33a0e0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    exampleThe runnable scripts under examples/, or a change that alters what one of them does or prints

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions