different-ai/openwork · error
failures.join("\n")
Error message
failures.join("\n") What it means
After a bulk cloud provider sync the store collects per-provider failure messages; if any failures accumulated it throws a single Error whose message is all failures joined by newlines. This surfaces aggregate sync problems (auth, missing credentials, server unavailability per provider) to the caller.
Source
Thrown at apps/app/src/react-app/domains/connections/provider-auth/store.ts:2075
failures.push(recordCloudProviderSyncError(liveProvider.id, reason, error));
}
}
await refreshProvidersAfterCloudSync(
configChanged ? { dispose: true } : { force: true },
).catch(() => null);
// Notify the UI about newly imported providers so the global toast
// can be shown regardless of which route is active.
if (newlyImported.length > 0) {
dispatchNewProviders({
providers: newlyImported,
source: reason === "sign_in" ? "sign_in" : "cloud_sync",
});
}
if (failures.length > 0) {
throw new Error(failures.join("\n"));
}
}
async function runCloudProviderSync(reason: CloudProviderSyncReason) {
if (!hasCloudProviderSyncPrerequisites()) {
if (reason === "settings_cloud_opened") {
setStateField("providerAuthError", null);
}
return;
}
if (getOpenworkGatewayOrigin()) {
if (!loggedGatewayCloudProviderSyncSkip) {
loggedGatewayCloudProviderSyncSkip = true;
console.info(
`[cloud-provider-sync:${reason}] Provider materialization is handled server-side in gateway mode.`,
);
}
return { outcome: "handled_server_side" };View on GitHub (pinned to 2b7df46e8a)
Solutions
- Read the multi-line error message to identify which providers failed and fix each cause (missing org credentials, server availability).
- Catch the error and log/aggregate per-provider failures in the UI instead of failing silently.
- Re-run sync after fixing the failing providers; successfully imported ones are not retried as imports.
- Ensure org credentials and server connectivity are healthy before bulk sync.
Example fix
// before
await store.syncCloudProviders(); // throws joined failure list
// after
try {
await store.syncCloudProviders();
} catch (e) {
const perProvider = String(e.message).split("\n");
perProvider.forEach(showProviderFailure);
} Defensive patterns
Strategy: try-catch
Validate before calling
const s = readDenSettings(); const ready = Boolean(s.authToken?.trim()) && Boolean(s.activeOrgId?.trim()) && openworkServer.getSnapshot().openworkServerClient != null; if (!ready) fixPrerequisitesBeforeSync();
Type guard
null
Try / catch
try {
await store.syncCloudProviders();
} catch (e) {
const failures = String((e as Error).message).split("\n");
failures.forEach((f) => logProviderFailure(f));
} Prevention
- Split the joined multi-line message to attribute failures per provider
- Verify org credentials and server connectivity before bulk sync
- Aggregate and display per-provider failures instead of a raw throw
- Re-run sync incrementally after fixing failing providers
When it happens
Trigger: runCloudProviderSync/import flow where one or more providers fail to import or sync — e.g. mixed causes like CloudProviderNeedsCredentialError for one provider and a network error for another; the joined message is the final thrown error.
Common situations: Org with several cloud providers where only some have valid credentials; transient network failures during bulk sync; partial server outages.
Related errors
- Cloud provider sync returned no result.
- Invalid cloud provider sync response.
- Invalid cloud provider sync status.
- Invalid cloud provider sync status response.
- Sign in to OpenWork Cloud and choose an organization first.
AI-assisted analysis of different-ai/openwork@2b7df46e8a (2026-09-01).
Data as JSON: /api/errors/eabcc0e7d8f065fd.
Report an issue: GitHub.