Skip to content

Bug: notion db insert fails with \"Attributes title not defined for properties in schema\" #4

Description

@chen-gdp

Bug Description

Command notion db insert <database_id> --title "New Task" fails with error:

"Attributes title not defined for properties in schema Database"

Root Cause

The create_page() method in ultimate_notion uses attribute names (snake_case like task_name) not property names (like "Task name").

When users provide --title "New Task", the CLI was passing title="New Task" to create_page(), but the database schema expects task_name="New Task".

File Affected

src/notion_cli/commands/database.py - db_insert function

Fix

Get the title attribute name from the schema and convert properly:

title_attr = title_prop.name.lower().replace(" ", "_")  # "Task name" -> "task_name"
kwargs = {title_attr: title, **props}
page = db.create_page(**kwargs)

Expected Behavior

notion db insert <database_id> --title "New Task"
# Should create a new entry in the database

Status

Fixed in recent commits.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions