different-ai/openwork · error
This cloud provider has not been imported into the workspace
Error message
This cloud provider has not been imported into the workspace.
What it means
Removing a cloud provider requires it to have been previously imported; the store looks up state.importedCloudProviders[cloudProviderId] and throws this error when no record exists. Without an import record there are no local provider credentials to remove, so the operation is refused.
Source
Thrown at apps/app/src/react-app/domains/connections/provider-auth/store.ts:1811
const result = await connectCloudProviderInternal(cloudProviderId);
setCloudProviderSyncError(cloudProviderId, null);
return result;
} catch (error) {
setCloudProviderSyncError(cloudProviderId, describeCloudProviderSyncError(error));
throw error;
}
}
async function removeCloudProviderInternal(
cloudProviderId: string,
optionsArg?: { silent?: boolean },
) {
if (!optionsArg?.silent) {
setStateField("providerAuthError", null);
}
const imported = state.importedCloudProviders[cloudProviderId];
if (!imported) {
throw new Error("This cloud provider has not been imported into the workspace.");
}
try {
try {
await removeProviderAuthCredentials(imported.providerId);
} catch (error) {
const message = error instanceof Error ? error.message : String(error ?? "");
if (!/not found|unknown auth|404/i.test(message.toLowerCase())) {
throw error;
}
}
// Runtime-managed: delete the provider entry via the server's per-key
// merge (`null` deletes), then strip any legacy opencode.jsonc block
// left by pre-runtime builds. Both are idempotent.
await patchRuntimeProviders({ [imported.providerId]: null });
await stripLegacyCloudProviderBlocks([imported.providerId]);
const nextImportedProviders = { ...state.importedCloudProviders };View on GitHub (pinned to 2b7df46e8a)
Solutions
- Check state.importedCloudProviders[cloudProviderId] exists before calling the remove action.
- Refresh the cloud provider list from the store so the UI only shows imported providers.
- Guard against double-removal by disabling the remove button once the provider is gone.
- In tests, seed the store's importedCloudProviders before invoking removal.
Example fix
// before await store.removeCloudProvider(cloudProviderId); // after if (!store.getState().importedCloudProviders[cloudProviderId]) return; // nothing to remove await store.removeCloudProvider(cloudProviderId);
Defensive patterns
Strategy: validation
Validate before calling
const imported = store.getState().importedCloudProviders[cloudProviderId]; if (!imported) return; // nothing to remove
Type guard
function isImported(state: { importedCloudProviders: Record<string, unknown> }, id: string): boolean {
return Boolean(state.importedCloudProviders[id]);
} Try / catch
try {
await store.removeCloudProvider(cloudProviderId);
} catch (e) {
if (String((e as Error).message).includes("not been imported")) {
refreshProviderList();
}
} Prevention
- Drive remove buttons from the live importedCloudProviders map
- Disable remove for non-imported providers
- Handle double-click/double-remove idempotently in the UI
- Seed imported providers in tests before removal
When it happens
Trigger: Calling the remove-cloud-provider action with an id never imported in this workspace, after the imported map was reset (app state cleared/reloaded), or with a mistyped/duplicated cloudProviderId.
Common situations: UI stale after state reset showing a provider that is no longer imported; double-remove after a first successful removal; tests using an arbitrary id without seeding importedCloudProviders.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- Invalid cloud provider sync response.
- Invalid cloud provider sync status.
- Invalid cloud provider sync status response.
- OpenCode is not configured for a local workspace
- Agent context diagnostics timeout must be between 1 ms and 3
AI-assisted analysis of different-ai/openwork@2b7df46e8a (2026-09-01).
Data as JSON: /api/errors/43d37281a6797fbc.
Report an issue: GitHub.