Skip to content

Crash on session load: todos array not initialized on new sessions (X.map / ze.filter is not a function) #19

@magsbrother

Description

@magsbrother

Bug Description

When opening a project in yume, the app crashes with X.map is not a function or ze.filter is not a function. The root cause is that newly created sessions do not include a todos field in their persisted state, but the UI components assume todos is always an array and call .map() / .filter() on it without a null/undefined guard.

Steps to Reproduce

  1. Open yume v0.24.2
  2. Load a project (in my case /home/*/pythia)
  3. A new session is created — the app immediately crashes with an error boundary ("ClaudeChat")

Errors

Error 1:

X.map is not a function.
(In 'X.map((ce,H)=>t.jsxs("div",{className:`todo-item ${ce.status}`, ...}))', 'X.map' is undefined)

Stack: zp@main-HVQXqGP9.js:88:2576

Error 2:

ze.filter is not a function.
(In 'ze.filter(D=>D.status==="completed")', 'ze.filter' is undefined)

Stack: @main-HVQXqGP9.js:116:4498

Both errors originate from the same issue — the todo list rendering component and its analytics/filter logic.

Root Cause

Inspecting the localstorage database (io.github.aofp.yume/localstorage/tauri_localhost_0.localstorage), newly created sessions have this shape:

{
  "id": "session-...",
  "name": "...",
  "workingDirectory": "/path/to/project",
  "messages": [],
  "analytics": { ... },
  "modifiedFiles": [],
  "createdAt": "...",
  "updatedAt": "..."
}

There is no todos key. The UI component reads session.todos and immediately calls .map() / .filter() on it, which throws because undefined is not iterable.

Workaround

Manually patching the session data in localstorage fixes it until the next new session is created:

import sqlite3, json

db = '/home/USER/.local/share/io.github.aofp.yume/localstorage/tauri_localhost_0.localstorage'
conn = sqlite3.connect(db)
cur = conn.cursor()
cur.execute('SELECT value FROM ItemTable WHERE key="yume-sessions"')
sessions = json.loads(cur.fetchone()[0])
for s in sessions:
    if 'todos' not in s:
        s['todos'] = []
cur.execute('UPDATE ItemTable SET value=? WHERE key="yume-sessions"', (json.dumps(sessions),))
conn.commit()
conn.close()

However, this must be repeated each time a new session is created, since the bug is in session initialization — not in the persisted data.

Suggested Fix

Either:

  1. Initialize todos: [] when creating a new session (preferred — fix at the source)
  2. Add a guard in the UI component: (session.todos ?? []).map(...) / (session.todos ?? []).filter(...)

Ideally both, for defense in depth.

Environment

  • yume version: 0.24.2 (installed via .deb)
  • OS: Ubuntu 24.04.3 LTS (Noble Numbat)
  • Kernel: 6.17.0-19-generic x86_64
  • Install method: dpkg -i yume_0.24.2_amd64.deb

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