startSync2 sometimes fails on device, not reproducible in simulator

Hi,

While posting in another thread about my progress implementing Wi-Fi sync, I wanted to start a new one to ask for advice on a specific issue.

In my app, the user can manually trigger a Wi-Fi sync. On my real Epix Pro Gen 2, the sync sometimes fails with a “Sync Failed” message shown on the watch.

This does not happen in the simulator. I can reproduce it if I try often enough, but I cannot pinpoint what triggers it.

What I have found and tried so far:

  • The failure happens after Communications.startSync2() is called and before SyncDelegate.onStartSync() is invoked.

  • There is no API feedback to the app code that the sync failed.

  • Wi-Fi connection quality seems fine (close to the access point, no movement between successful and failing attempts).

  • I verified there are no other events running that might interfere (Wi-Fi checks, timers, web requests).

  • When starting a failing sync, System.getDeviceSettings().connectionInfo[:wifi].state is 1 (not connected).

  • I suspect a timing component. The failure occurs more often when starting a sync shortly after a previous sync. Also, if I retry immediately after a failure, it often fails again. However, it is not consistently reproducible, since often enough syncs immediately after syncs succeed too.

Has anyone seen something similar, or have an idea what could cause this?

Also, is there any way to detect this in code? So far, the only workaround I can think of is starting a timer when calling startSync2(), and if onStartSync() is not called within a certain time, assuming the sync failed. That feels hacky.

Screenshot of the watch error attached.

Thanks!