matrix-org / matrix-org/matrix-rust-sdk
Update from sync_v2 to sync_v3 breaks with synapse
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 2.3k
- Forks
- 500
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 106
Description
Going from using sync v2 to sync v3 without recreating the complete local stat results in the following error:
```log
2026-04-03T15:14:16.719408Z ERROR matrix_sdk::http_client: Error while sending request: Api(Server(ClientApi(Error { status_code: 400, body: Standard(StandardErrorBody { kind: InvalidParam, message: "1 validation error for SlidingSyncBody\nextensions.to_device.since\n Value error, 'extensions.to_device.since' is invalid (should look like an int) [type=value_error, input_value='s675526_31837266_11472_1..._10832_1285567_0_56_2_1', input_type=str]\n For further information visit https://errors.pydantic.dev/2.12/v/value_error" }) })))
2026-04-03T15:14:16.719513Z ERROR matrix_sdk_ui::sync_service: Error while processing encryption in sync service: Some(
EncryptionSync(
SlidingSync(
Http(
Api(
Server(
ClientApi(
Error {
status_code: 400,
body: Standard(
StandardErrorBody {
kind: InvalidParam,
message: "1 validation error for SlidingSyncBody\nextensions.to_device.since\n Value error, 'extensions.to_device.since' is invalid (should look like an int) [type=value_error, input_value='s675526_31837266_11472_1..._10832_1285567_0_56_2_1', input_type=str]\n For further information visit https://errors.pydantic.dev/2.12/v/value_error",
},
),
},
),
),
),
),
),
),
)
```
This seems to be because the next_batch token that is used by sync_v2 and the main sync_v3 is also used as the token for the `to_device` extension. Synapse just uses an incrementing integer for this token and thus fails to parse the underscore separated value of the normal token.
Deleting the sqlite store and logging in resolves the issue but is an unpleasant user experience because the device needs to be re-verified.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No file or test is named. Start by tracing how the persisted next_batch token is reused when moving from sync v2 to sync v3, especially for the to_device extension, and reproduce the upgrade with the existing SQLite store. Done means an upgraded store no longer sends the sync token where an integer to_device token is required and does not require re-verification.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100