Crashes on one-way sync after field edit (schema change) when upload size > ~2 GiB — OverflowError in QProgressBar.setMaximum

Problem Description

After adding a new field (which triggers a schema change) and choosing the “Upload to AnkiWeb / one-way sync (upload)” option, Anki consistently crashes during the sync progress phase.

  • Environment

    • Anki: 25.09 (539054c3)

    • OS: macOS 15.6.1 (Apple Silicon)

    • Python 3.13.5, Qt 6.9.1, PyQt 6.9.1

    • Sync backend: self-hosted Anki sync server (not AnkiWeb)

    • Add-ons: issue reproduces in Safe Mode (Shift-launch), so add-ons are not involved.

  • Steps to Reproduce

    1. Edit note fields (add a field), which triggers a schema change.

    2. When prompted, choose the one-way upload option to sync.

    3. Sync starts; as progress updates, Anki crashes.

  • Observed Behavior

    Anki exits with an OverflowError raised from aqt/progress.py while updating the progress bar.

  • Expected Behavior

    One-way upload should complete (or at least report the error) without crashing.

  • Additional Observations

    • The crash only happens when the total size to upload is greater than ~2 GiB (collection and/or media involved in the one-way upload).

    • Workaround: temporarily remove part of my decks (to reduce the total upload size under ~2 GiB), then the upload completes without crashing.

  • Hypothesis (for maintainers):

    The stack points to QProgressBar.setMaximum(self._max) receiving a value larger than a 32-bit signed int (INT_MAX = 2,147,483,647). If the progress bar is using raw byte counts for “maximum/ value,” a transfer > ~2 GiB would overflow and crash.

Log

Anki 25.09 (539054c3) (ao)

Python 3.13.5 Qt 6.9.1 PyQt 6.9.1

Platform: macOS-15.6.1-arm64-arm-64bit-Mach-O

Traceback (most recent call last):

File “/Users/xxx/Library/Application Support/AnkiProgramFiles/.venv/lib/python3.13/site-packages/aqt/sync.py”, line 273, in on_timer

on_full_sync_timer(mw, label)

\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~^^^^^^^^^^^

File “/Users/xxx/Library/Application Support/AnkiProgramFiles/.venv/lib/python3.13/site-packages/aqt/sync.py”, line 214, in on_full_sync_timer

mw.progress.update(

\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~^

    value=sync_progress.transferred,

    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

...<2 lines>...

    label=label,

    ^^^^^^^^^^^^

)

^

File “/Users/xxx/Library/Application Support/AnkiProgramFiles/.venv/lib/python3.13/site-packages/aqt/progress.py”, line 225, in update

self.\_win.form.progressBar.setMaximum(self.\_max)

\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~\~^^^^^^^^^^^

OverflowError: argument 1 overflowed: value must be in the range -2147483648 to 2147483647

2 Likes

I’m using Anki’s self hosted server (built into Anki), so far it’s working fine with the latest version of Anki. if I remember correctly the error like this can occur when tags (or decks?) contain special characters (I don’t know the exact details), so you might want to check those.