Skip to content

Bug: SD card sync transfer fails with 'Bad state: No element' #6656

Closed

Description

@omi-discord-vector

What happens

During manual SD card sync on Android, transfer can fail with:

Transfer failed: Bad state: No element

Root cause (likely)

In app/lib/services/wals/sdcard_wal_sync.dart:

  • Line ~857: _wals.where((w) => w == wal).toList().first throws when wal is not found in _wals (race condition / stale state)
  • Line ~1064: wals.last can throw when wals is empty

Safe pattern is already used elsewhere in the same file (e.g. .firstOrNull + null guards).

Proposed fix

Replace .first / .last with .firstOrNull / .lastOrNull (or equivalent) and add null/empty guards.

Context

Android, Omi CV1 firmware 3.0.17, latest Play Store app.

Activity

  1. added
    p2
    on Apr 15, 2026
  2. added a commit that references this issue on Apr 18, 2026
    cde758d
  3. self-assigned this
    on Apr 18, 2026
  4. added a commit that references this issue on Apr 19, 2026
    b9fa958
  5. added 2 commits that reference this issue on Apr 28, 2026
    605d93c
    ac738ce
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

p2

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions