Repository: vscode
Issue: Invalid requests error when turning on settings sync
Labels: bug,settings-sync,settings-sync-server

I had a "Sign in to Settings Sync (1)" in my settings menu. I did so and ran into a "invalid request" error. These are the logs:

```
2024-07-25 10:33:35.412 [info] Using settings sync service https://vscode-sync-insiders.trafficmanager.net/
2024-07-25 10:33:35.412 [info] Auto Sync is enabled.
2024-07-25 10:33:35.412 [info] Auto Sync: Suspended until auth token is available.
2024-07-25 11:22:39.851 [info] Auto Sync: Triggered by Interval
2024-07-25 11:22:39.851 [info] Sync started.
2024-07-25 11:22:40.409 [info] Settings: Updated remote settings
2024-07-25 11:22:40.416 [info] Settings: Updated last synchronized settings
2024-07-25 11:22:40.438 [info] Keybindings: No changes found during synchronizing keybindings.
2024-07-25 11:22:40.458 [info] Snippets: No changes found during synchronizing snippets.
2024-07-25 11:22:40.465 [info] Tasks: No changes found during synchronizing tasks.
2024-07-25 11:22:40.542 [info] GlobalState: Updated remote ui state. Added: testCallStackVisible,workbench.view.extension.vscode-edge-devtools-view.state.hidden,terminal-inline-chat-history,remote.tunnels.toRestore.ssh-remote+mutator.1272660455,remote.tunnels.toRestoreExpiration.ssh-remote+mutator.1272660455,typescript.1.isCandidate,typescript.1.skipVersion,memento/notebookGettingStarted2,workbench.view.extension.dockerView.state.hidden. Updated: commandPalette.mru.cache,commandPalette.mru.counter,cpp.1.lastSessionDate,cpp.1.sessionCount,fileBasedRecommendations/promptedRecommendations,github-connor4312,java.2.lastSessionDate,java.2.sessionCount,memento/gettingStartedService,remote.explorerType,snippets.usageTimestamps,workbench.activity.pinnedViewlets2,workbench.explorer.views.state.hidden,workbench.view.debug.state.hidden,typescript.1.lastSessionDate,typescript.1.sessionCount,nps/lastSessionDate,nps/sessionCount,typescript.1.editedCount,typescript.1.editedDate,csharp.1.lastSessionDate,csharp.1.sessionCount,extension.features.state,languageModelStats.gpt-3.5-turbo.
2024-07-25 11:22:40.548 [info] GlobalState: Updated last synchronized ui state
2024-07-25 11:22:40.616 [info] Profiles: Created profile 'Untitled<'.
2024-07-25 11:22:40.616 [info] Profiles: Created profile 'Untitled'.
2024-07-25 11:22:40.622 [info] Profiles: Updated last synchronized profiles.
2024-07-25 11:22:40.626 [info] Syncing profile. empty
2024-07-25 11:22:40.677 [info] Settings (empty): No changes found during synchronizing settings.
2024-07-25 11:22:40.682 [info] Keybindings (empty): No changes found during synchronizing keybindings.
2024-07-25 11:22:40.684 [info] Snippets (empty): No changes found during synchronizing snippets.
2024-07-25 11:22:40.685 [info] Tasks (empty): No changes found during synchronizing tasks.
2024-07-25 11:22:40.692 [info] GlobalState (empty): No changes found during synchronizing ui state.
2024-07-25 11:22:40.692 [info] Syncing profile. ext-profile
2024-07-25 11:22:40.697 [info] GlobalState (ext-profile): No changes found during synchronizing ui state.
2024-07-25 11:22:40.698 [info] Syncing profile. Untitled
2024-07-25 11:22:40.698 [info] Settings (Untitled): Migrating last sync user data. Resource does not exist.
2024-07-25 11:22:40.698 [info] Settings (Untitled): Last sync data state does not exist.
2024-07-25 11:22:40.715 [info] Request failed {"url":"https://vscode-sync-insiders.trafficmanager.net/v1/collection/ec58eef6-4b3c-413b-bdc1-30a208c5bf37/resource/settings/latest","status":405,"execution-id":"204bf62e-e3d5-4157-87e0-e6df85fef333","operation-id":"25deaa630e9b434f96f191b93a6c0ed8"} Cannot modify non-existent collection
2024-07-25 11:22:40.717 [error] MethodNotFound (UserDataSyncError) syncResource:unknown operationId:25deaa630e9b434f96f191b93a6c0ed8: GET request 'https://vscode-sync-insiders.trafficmanager.net/v1/collection/ec58eef6-4b3c-413b-bdc1-30a208c5bf37/resource/settings/latest' failed because the requested endpoint is not found (405). Cannot modify non-existent collection
    at N.D (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/code/node/sharedProcess/sharedProcessMain.js:114:138244)
    at async N.readResource (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/code/node/sharedProcess/sharedProcessMain.js:114:133296)
    at async c.getRemoteUserData (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/code/node/sharedProcess/sharedProcessMain.js:114:20737)
    at async c.U (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/code/node/sharedProcess/sharedProcessMain.js:114:11690)
    at async c.sync (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/code/node/sharedProcess/sharedProcessMain.js:114:10970)
    at async o.sync (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/code/node/sharedProcess/sharedProcessMain.js:114:119698)
    at async r.S (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/code/node/sharedProcess/sharedProcessMain.js:114:111034)
    at async r.Q (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/code/node/sharedProcess/sharedProcessMain.js:114:110466)
    at async r.P (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/code/node/sharedProcess/sharedProcessMain.js:114:110010)
2024-07-25 11:22:40.721 [info] Auto Sync: Client is making invalid requests. Cleaning up data...
2024-07-25 11:22:40.764 [info] Deleting 2 redundant collections on server
2024-07-25 11:22:40.818 [info] Deleted redundant collections on server
2024-07-25 11:22:40.818 [info] Resetting the last synced state of profiles
2024-07-25 11:22:40.819 [info] Did reset the last synced state of profiles
2024-07-25 11:22:40.819 [info] Updating remote profiles with invalid collections on server
2024-07-25 11:22:41.016 [info] Updated remote profiles on server
2024-07-25 11:22:41.016 [info] Auto Sync: Retrying sync...
2024-07-25 11:22:41.016 [info] Sync started.
2024-07-25 11:22:41.040 [info] Settings: No changes found during synchronizing settings.
2024-07-25 11:22:41.041 [info] Keybindings: No changes found during synchronizing keybindings.
2024-07-25 11:22:41.043 [info] Snippets: No changes found during synchronizing snippets.
2024-07-25 11:22:41.044 [info] Tasks: No changes found during synchronizing tasks.
2024-07-25 11:22:41.047 [info] GlobalState: No changes found during synchronizing ui state.
2024-07-25 11:22:41.047 [info] Profiles: Migrating last sync user data. Resource does not exist.
2024-07-25 11:22:41.047 [info] Profiles: Last sync data state does not exist.
2024-07-25 11:22:41.204 [info] Profiles: Updated remote profiles. Added: ["Untitled<","Untitled"].
2024-07-25 11:22:41.209 [info] Profiles: Updated last synchronized profiles.
2024-07-25 11:22:41.213 [info] Syncing profile. empty
2024-07-25 11:22:41.214 [info] Settings (empty): No changes found during synchronizing settings.
2024-07-25 11:22:41.215 [info] Keybindings (empty): No changes found during synchronizing keybindings.
2024-07-25 11:22:41.216 [info] Snippets (empty): No changes found during synchronizing snippets.
2024-07-25 11:22:41.216 [info] Tasks (empty): No changes found during synchronizing tasks.
2024-07-25 11:22:41.217 [info] GlobalState (empty): No changes found during synchronizing ui state.
2024-07-25 11:22:41.217 [info] Syncing profile. ext-profile
2024-07-25 11:22:41.217 [info] GlobalState (ext-profile): No changes found during synchronizing ui state.
2024-07-25 11:22:41.218 [info] Syncing profile. Untitled
2024-07-25 11:22:41.218 [error] Profile synchronizer collection does not match with the remote sync profile collection
2024-07-25 11:22:41.218 [info] Settings (Untitled): Migrating last sync user data. Resource does not exist.
2024-07-25 11:22:41.218 [info] Settings (Untitled): Last sync data state does not exist.
2024-07-25 11:22:41.235 [info] Request failed {"url":"https://vscode-sync-insiders.trafficmanager.net/v1/collection/e41e333f-9f53-4cc9-a0a4-02dbf1ab5066/resource/settings/latest","status":405,"execution-id":"5fb4b1ec-a36c-4082-a78c-b0acc9078b93","operation-id":"f34751f8bbb448858aa78dc206bd6671"} Cannot modify non-existent collection
2024-07-25 11:22:41.235 [error] MethodNotFound (UserDataSyncError) syncResource:unknown operationId:f34751f8bbb448858aa78dc206bd6671: GET request 'https://vscode-sync-insiders.trafficmanager.net/v1/collection/e41e333f-9f53-4cc9-a0a4-02dbf1ab5066/resource/settings/latest' failed because the requested endpoint is not found (405). Cannot modify non-existent collection
    at N.D (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/code/node/sharedProcess/sharedProcessMain.js:114:138244)
    at async N.readResource (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/code/node/sharedProcess/sharedProcessMain.js:114:133296)
    at async c.getRemoteUserData (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/code/node/sharedProcess/sharedProcessMain.js:114:20737)
    at async c.U (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/code/node/sharedProcess/sharedProcessMain.js:114:11690)
    at async c.sync (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/code/node/sharedProcess/sharedProcessMain.js:114:10970)
    at async o.sync (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/code/node/sharedProcess/sharedProcessMain.js:114:119698)
    at async r.S (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/code/node/sharedProcess/sharedProcessMain.js:114:111034)
    at async r.Q (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/code/node/sharedProcess/sharedProcessMain.js:114:110466)
    at async r.P (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/code/node/sharedProcess/sharedProcessMain.js:114:110010)
2024-07-25 11:22:41.296 [info] Auto Sync: Disabled.
2024-07-25 11:22:41.296 [info] Auto Sync: Stopped
2024-07-25 11:22:41.305 [info] Did reset the local sync state.
2024-07-25 11:22:41.305 [info] Auto Sync: Turned off sync because current client is making requests to server that are not supported
```

I turned settings sync off and on again and it worked.