Skip to content

GET /api/notebooks/{id} returns 500 for an id without the table prefix #1452

Open

Description

@lfnovo

Found by the pre-release smoke test (2026-10-04).

Problem

GET /api/notebooks/abc123 (no notebook: prefix) returns 500: invalid string provided for parse. the expected string format is "table_name:record_id". The other single-record endpoints handle the same input: GET /api/sources/abc123, /api/notes/abc123 and /api/transformations/abc123 return 400, and /api/episode-profiles/abc123 returns 404.

The UI always sends the prefixed id, so this only affects API clients and hand-typed URLs.

Expected outcome

get_notebook (api/routers/notebooks.py) either normalizes a bare id to notebook:<id> or returns 400, consistent with sources/notes. A well-formed id that doesn't exist stays 404.

Acceptance criteria

  • GET /api/notebooks/abc123 returns 400 (or resolves the prefixed id); GET /api/notebooks/notebook:missing stays 404.
  • Test covers both.

Activity

  1. added
    bugSomething isn't working
    readyApproved and ready to be worked on
    area: notebooksNotebook features: notes, insights, transformations
    on Oct 4, 2026
  2. adityawaghamare commented on Oct 4, 2026

    @adityawaghamare

    Solution Summary

    Summary

    Fixes an issue where GET /api/notebooks/{id} returns a 500 internal server error when an ID without the table prefix (e.g. abc123) is provided, instead of a 400 or properly handling it like other single-record endpoints.

    Changes

    • Updated get_notebook in api/routers/notebooks.py to catch ValueError / record ID parsing errors or check/normalize the notebook ID format, returning a 400 Bad Request error when an invalid un-prefixed or malformed record ID string is supplied.

    Verification

    • Run tests via pytest to ensure GET /api/notebooks/abc123 returns 400 and GET /api/notebooks/notebook:missing returns 404.

    Closes #1452

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

    area: notebooksNotebook features: notes, insights, transformationsbugSomething isn't workinggood first issueGood for newcomersreadyApproved and ready to be worked on

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions