Skip to content

Upload md fails when parent note does not exist, does not forward error #53

@maphew

Description

@maphew

Code

# /// script
# dependencies = [
#   "trilium-py",
# ]
# ///
from trilium_py.client import ETAPI
server_url = 'http://localhost:8080'
token = '*******'
ea = ETAPI(server_url, token)

res = ea.upload_md_file(
    parentNoteId="import-single-md",
    file="./sample/something-2.md",
)
❯ uv run xx-debug.py
2025-03-15 10:08:09.125 | INFO     | trilium_py.client:upload_md_file:951 - /var/home/matt/dev/trilium-py/examples/uv/sample/something-2.md

portion of http://localhost:8080/#root/_hidden/_backendLog:

10:08:09.159 ERROR: post /etapi/create-note threw exception Validation failed on property 'parentNoteId': Note 'import-single-md' does not exist. with stacktrace: Error: Validation failed on property 'parentNoteId': Note 'import-single-md' does not exist.

So first problem is that the script thinks it succeeded but didn't, but the deeper issue is that trilium-py doesn't report that the server complained so we don't know anything until investigating the backend.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions