{"record":{"id":"8b0715fb8f2913c1","repo":"different-ai/openwork","slug":"provider-name-does-not-have-a-stored-organizat","errorCode":null,"errorMessage":"`${provider.name} does not have a stored organization credential yet.`","messagePattern":"`(.+?) does not have a stored organization credential yet\\.`","errorType":"exception","errorClass":"CloudProviderNeedsCredentialError","httpStatus":null,"severity":"error","filePath":"apps/app/src/react-app/domains/connections/provider-auth/store.ts","lineNumber":1684,"sourceCode":"    const token = settings.authToken?.trim() ?? \"\";\n    const orgId = settings.activeOrgId?.trim() ?? \"\";\n    if (!token || !orgId) {\n      throw new Error(\"Sign in to OpenWork Cloud and choose an organization first.\");\n    }\n\n    try {\n      const den = createDenClient({\n        baseUrl: settings.baseUrl,\n        token,\n      });\n      const provider = await den.getOrgLlmProviderConnection(orgId, cloudProviderId);\n      const localProviderId = getCloudManagedProviderId(provider);\n      assertProviderAllowedByDesktopPolicy(localProviderId);\n      const existingImported = state.importedCloudProviders[cloudProviderId] ?? null;\n      const { envEntries, primaryApiKey } = resolveCloudProviderCredentials(provider);\n      const env = getCloudProviderEnv(provider.providerConfig);\n      if (!primaryApiKey && env.length > 0) {\n        throw new CloudProviderNeedsCredentialError(\n          `${provider.name} does not have a stored organization credential yet.`,\n        );\n      }\n\n      await assertCloudProviderImportSafe(provider);\n\n      if (envEntries.length > 0) {\n        const openworkClient = options.openworkServer.getSnapshot().openworkServerClient;\n        if (!openworkClient) {\n          throw new CloudProviderNeedsServerError(\n            `${provider.name} needs environment variables (${envEntries\n              .map((entry) => entry.key)\n              .join(\", \")}) but the OpenWork server is not available.`,\n          );\n        }\n        await openworkClient.upsertUserEnv(envEntries);\n      }\n      if (primaryApiKey) {","sourceCodeStart":1666,"sourceCodeEnd":1702,"githubUrl":"https://github.com/different-ai/openwork/blob/2b7df46e8ae1517d64c896c7793d2d52ec845669/apps/app/src/react-app/domains/connections/provider-auth/store.ts#L1666-L1702","documentation":"When importing a cloud-managed provider, the store resolves the organization's stored credentials for that provider. If no primary API key is stored but the provider's config declares environment-variable entries, it throws CloudProviderNeedsCredentialError naming the provider. The import is aborted because the workspace would end up with an unusable provider.","triggerScenarios":"Importing a provider whose org credential was never set (or was deleted) in OpenWork Cloud while its providerConfig requires env vars; syncing cloud providers after an admin removed the org-level key.","commonSituations":"New provider added to the org marketplace without storing its key; key rotated/removed server-side; user imports from a different org that lacks the credential.","solutions":["Store the provider's API key as an organization credential in OpenWork Cloud (admin/marketplace settings), then retry the import.","Catch CloudProviderNeedsCredentialError in the UI and prompt the user/admin to add the org credential.","Verify you are in the org that actually holds the credential.","Re-sync cloud providers after the credential is added."],"exampleFix":"// before\nawait store.importCloudProvider(id); // throws CloudProviderNeedsCredentialError\n// after\ntry {\n  await store.importCloudProvider(id);\n} catch (e) {\n  if (e instanceof CloudProviderNeedsCredentialError) {\n    promptAdminToStoreOrgCredential(providerName);\n  }\n}","handlingStrategy":"try-catch","validationCode":"const { primaryApiKey } = resolveCloudProviderCredentials(provider);\nconst env = getCloudProviderEnv(provider.providerConfig);\nif (!primaryApiKey && env.length > 0) promptOrgCredentialSetup(provider.name);","typeGuard":"function hasOrgCredential(p: { name: string }): boolean {\n  return Boolean(resolveCloudProviderCredentials(p).primaryApiKey);\n}","tryCatchPattern":"try {\n  await store.importCloudProvider(cloudProviderId);\n} catch (e) {\n  if (e instanceof CloudProviderNeedsCredentialError) {\n    showOrgCredentialPrompt(e.message);\n  }\n}","preventionTips":["Store org credentials before publishing a provider to the marketplace","Filter import UI to providers with resolvable credentials","Catch CloudProviderNeedsCredentialError and guide admins to add the key","Re-sync after credentials change server-side"],"tags":["cloud","credentials","configuration"],"backgroundTag":"missing-org-credential","analyzedSha":"2b7df46e8ae1517d64c896c7793d2d52ec845669","analyzedAt":"2026-09-01T07:59:23.713Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}