Skip to content

[Bug]: Corrupted time_archived in SQLite causes HTTP 400 on session list — zero sessions shown #543

@raz123

Description

@raz123

Bug

A single session with a malformed time_archived value in the SQLite database causes the entire session list API to fail with HTTP 400. This makes CodeNomad display zero sessions with no error indication.

Root Cause

The OpenCode session list response is a paginated array. When serializing, the schema for SessionInfo.time.archived expects DateTime.Utc format, but the DB stores a raw millisecond timestamp:

1781132189927  (milliseconds since epoch)

When the encoder reaches the session with this bad value, serialization fails:

Expected DateTime.Utc, got 1781132189927
  at ["items"][37]["time"]["archived"]

Impact

Any session list request with a page size larger than the index of the corrupted session fails with HTTP 400. CodeNomad requests 50-200 sessions per page — if the bad session is within that range, ZERO sessions return. The UI never gets data and shows the empty "Start a conversation" state.

Reproduction

  1. Set any session's time_archived to a raw millisecond number in the shared SQLite DB
  2. Open a workspace with that session in CodeNomad
  3. Session list returns 0 items (HTTP 400 swallowed silently)

Fix

Two fixes needed:

  1. Data cleanup: Set the bad time_archived to NULL
  2. Resilience: The API should skip or gracefully handle individual session serialization failures rather than failing the entire response

Environment

  • CodeNomad v0.17.0 (Tauri) and v0.17.1 (web)
  • OpenCode binary v1.15.13

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions