{"record":{"id":"3cf721700d8eefbc","repo":"different-ai/openwork","slug":"cloud-provider-sync-returned-no-result","errorCode":null,"errorMessage":"Cloud provider sync returned no result.","messagePattern":"Cloud provider sync returned no result\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"apps/app/src/react-app/domains/connections/provider-auth/store.ts","lineNumber":2111,"sourceCode":"      return { outcome: \"handled_server_side\" };\n    }\n\n    if (serverHandlesProviderSync()) {\n      try {\n        const result = await enqueueGlobalCloudProviderSync(\n          `server:${getCloudProviderSyncContextKey()}`,\n          async () => {\n            const openworkClient = options.openworkServer.getSnapshot().openworkServerClient;\n            if (!openworkClient) throw new Error(\"OpenWork server unavailable.\");\n            let result = await openworkClient.runCloudProviderSyncNow(reason);\n            if (result.status === \"no_session\") {\n              await pushDenSession(true);\n              result = await openworkClient.runCloudProviderSyncNow(reason);\n            }\n            return result;\n          },\n        );\n        if (!result) throw new Error(\"Cloud provider sync returned no result.\");\n        // Re-derive the imported records (and reloadPending/skips) from the\n        // server's status after EVERY server-handled pass. Without this the\n        // Cloud Providers rows kept whatever the one-shot start() read found\n        // (usually nothing) and sat on \"Syncing\" forever even though the\n        // server had long since applied the sync (#3671, UI layer).\n        await refreshImportedCloudProviders();\n        if (result.status === \"failed\" || result.status === \"no_session\") {\n          const message = logCloudProviderSyncError(\n            reason,\n            new Error(result.message ?? \"Cloud provider sync failed.\"),\n          );\n          publishSettingsCloudProviderSyncError(reason, message);\n          return;\n        }\n        // The server may already be synchronized while this route still holds\n        // a removed managed-model default. Always reread the live catalog and\n        // reconcile that preference so Settings diagnostics recover in place,\n        // including after a noop server sync.","sourceCodeStart":2093,"sourceCodeEnd":2129,"githubUrl":"https://github.com/different-ai/openwork/blob/2b7df46e8ae1517d64c896c7793d2d52ec845669/apps/app/src/react-app/domains/connections/provider-auth/store.ts#L2093-L2129","documentation":"In createProviderAuthStore's cloud provider sync flow, the code awaits a wrapper (withSessionRoute / similar) that resolves to the result of openworkClient.runCloudProviderSyncNow(reason). If the session route wrapper or the client call resolves to a falsy value (null/undefined), the store throws 'Cloud provider sync returned no result.' This is a defensive check against a server/client path that silently returned nothing instead of a sync result object.","triggerScenarios":"Calling the store's cloud provider sync action when runCloudProviderSyncNow returns null/undefined, or when the surrounding withSessionRoute wrapper short-circuits and returns undefined (e.g. session push failed or the route was disposed before the sync ran).","commonSituations":"OpenWork Cloud session not established or expired so the sync RPC never actually executes; server returns an empty body that the client deserializes to null; a race where the workspace/session route closed mid-sync; calling sync from a context (web/CI) without a Den connection.","solutions":["Verify the OpenWork Cloud session is signed in and pushDenSession succeeded before triggering the sync","Inspect the openworkClient.runCloudProviderSyncNow server response; fix the server/client so a completed sync always returns a result object","Retry the sync after re-establishing the session; check network/Den connectivity","Check logs for a session-route teardown that disposed the wrapper before the promise resolved"],"exampleFix":"// before\nconst result = await syncFn();\nif (!result) throw new Error(\"Cloud provider sync returned no result.\");\n// after\nconst result = await syncFn();\nif (!result) {\n  await pushDenSession(true); // re-establish session\n  const retried = await syncFn();\n  if (!retried) throw new Error(\"Cloud provider sync returned no result.\");\n}","handlingStrategy":"try-catch","validationCode":"const sessionReady = await isDenSessionActive(); // verify sign-in before syncing\nif (!sessionReady) await pushDenSession(true);","typeGuard":"function isSyncResult(r: unknown): r is CloudSyncResult {\n  return typeof r === \"object\" && r !== null && \"status\" in r;\n}","tryCatchPattern":"try {\n  await providerAuthStore.syncCloudProviders(reason);\n} catch (err) {\n  if (err.message === \"Cloud provider sync returned no result.\") {\n    await pushDenSession(true);\n    await providerAuthStore.syncCloudProviders(reason); // one retry after re-auth\n  } else throw err;\n}","preventionTips":["Always establish/renew the Den session before invoking cloud sync","Treat null sync results as retryable session failures, not hard errors","Log the raw runCloudProviderSyncNow response to distinguish empty results from transport errors","Avoid disposing session routes while a sync is in flight"],"tags":["cloud","sync","null-result","session"],"backgroundTag":"empty-server-response","analyzedSha":"2b7df46e8ae1517d64c896c7793d2d52ec845669","analyzedAt":"2026-09-01T07:59:23.713Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}