Skip to content

GET /api/session?limit=5000 500s (err_de187102) when a session path contains a URL #50401

Description

@johnbubak

Description

Description

GET /api/session?limit=5000&order=desc crashes with HTTP 500 (err_de187102), leaving the web UI session list completely empty.

Interestingly, limit=1000 returns 200 OK.

Log output (~/.local/share/opencode/log/opencode.log):

EffectDrizzleQueryError: Failed query: select ... from "session" order by "session"."time_created" desc, "session"."id" desc limit ?
params: 5000 (cause: Cause([Fail(Error: Path is not absolute: http://localhost:3333/L2hvbWUvamFuL3Byb2plY3RzL2hpcHBvY2FjdHVz/session/ses_13416c6c1ffeuwjo0B1mxirCjT)]))

Cause

An older session row in SQLite had a client URL stored in path/directory instead of a local filesystem path (likely from an old web copy-paste/fork action).

Because queries are ordered time_created DESC:

  • limit=1000 never touched that older row -> returned 200.
  • limit=5000 reached the corrupt row -> Drizzle isAbsolute(path) check failed -> crashed the whole query.

Suggested fix

Catch/ignore isAbsolute failures during session list hydration instead of blowing up the entire query for a single bad row.

Workaround for affected users

# Find bad entries:
sqlite3 ~/.local/share/opencode/opencode.db "SELECT id, path FROM session WHERE path LIKE 'http%';"

# Fix path (decode base64 part of the URL):
sqlite3 ~/.local/share/opencode/opencode.db "UPDATE session SET path='/path/to/project', directory='/path/to/project' WHERE id='<session_id>';"

Plugins

No response

OpenCode version

No response

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

Linux CachyOS

Terminal

COSMIC Terminal

No activity

Activity on this issue will appear here.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions