Skip to content

[Bug] iPod Nano 6G: sync fails when writing iTunesDB with struct.error in write_mhod_type53 #58

@BulatReznik

Description

@BulatReznik

Describe the bug
Sync fails when writing iTunesDB on my iPod Nano 6th Gen.
The device is detected correctly, the existing database is parsed successfully, backup completes successfully, and track processing starts, but the sync always fails during the database write stage with:

struct.error: 'H' format requires 0 <= number <= 65535

The traceback points to:

iTunesDB_Writer\mhod52_writer.pywrite_library_indices()write_mhod_type53()

This happens consistently and prevents music from being added to the iPod.

iPod model
iPod Nano 6th Gen (16GB, Silver, MC526)

To reproduce

  1. Connect the iPod Nano 6th Gen to Windows
  2. Open iOpenPod
  3. Let the app detect the device
  4. Add music for sync
  5. Start sync
  6. Wait until the app reaches the iTunesDB write stage
  7. See error: struct.error: 'H' format requires 0 <= number <= 65535

I reproduced this multiple times:

  • when adding 12 tracks
  • when adding only 1 track

Expected behavior
I expect the sync to complete successfully, iTunesDB to be written without errors, and the added music to appear on the iPod.

Screenshots / logs
Relevant log excerpt:

2026-04-02 08:18:47 [INFO] SyncEngine._db_io: Parsed iPod database: 572 tracks, 1 playlists, 2 smart playlists
2026-04-02 08:18:47 [INFO] SyncEngine.sync_executor: Stage 'add': processing 12 items with 8 workers
2026-04-02 08:18:59 [INFO] SyncEngine._playlist_builder: Prepared 0 user playlists for writing
2026-04-02 08:18:59 [INFO] SyncEngine._playlist_builder: Prepared 2 smart playlists (dataset 5) for writing
2026-04-02 08:19:16 [ERROR] SyncEngine._db_io: Failed to write iTunesDB: 'H' format requires 0 <= number <= 65535

<img width="285" height="233" alt="Image" src="https://github.com/user-attachments/assets/3b54819f-e75c-4a2f-8559-9d40cd8fbba5" />

Traceback (most recent call last):
  File "SyncEngine\_db_io.py", line 172, in write_database
  File "iTunesDB_Writer\mhbd_writer.py", line 883, in write_itunesdb
  File "iTunesDB_Writer\mhbd_writer.py", line 366, in write_mhbd
  File "iTunesDB_Writer\mhlp_writer.py", line 105, in write_mhlp_with_playlists
  File "iTunesDB_Writer\mhyp_writer.py", line 530, in write_master_playlist
  File "iTunesDB_Writer\mhyp_writer.py", line 242, in write_mhyp
  File "iTunesDB_Writer\mhod52_writer.py", line 327, in write_library_indices
  File "iTunesDB_Writer\mhod52_writer.py", line 277, in write_mhod_type53
struct.error: 'H' format requires 0 <= number <= 65535
2026-04-02 08:19:17 [ERROR] SyncEngine.sync_executor: Database write returned failure — skipping mapping save

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions