different-ai/openwork · error

Sign in to OpenWork Cloud and choose an organization first.

Error message

Sign in to OpenWork Cloud and choose an organization first.

What it means

When pushing Den session state the store reads saved OpenWork Cloud (Den) settings and requires both an auth token and an active organization id. If either is missing or blank it throws this plain-text guidance error, because org-scoped cloud operations cannot proceed unauthenticated.

Source

Thrown at apps/app/src/react-app/domains/connections/provider-auth/store.ts:1669

  }

  async function connectCloudProviderInternal(
    cloudProviderId: string,
    optionsArg?: { silent?: boolean },
  ) {
    if (!optionsArg?.silent) {
      setStateField("providerAuthError", null);
    }
    const c = options.client();
    if (!c) {
      throw new Error(t("providers.not_connected"));
    }

    const settings = readDenSettings();
    const token = settings.authToken?.trim() ?? "";
    const orgId = settings.activeOrgId?.trim() ?? "";
    if (!token || !orgId) {
      throw new Error("Sign in to OpenWork Cloud and choose an organization first.");
    }

    try {
      const den = createDenClient({
        baseUrl: settings.baseUrl,
        token,
      });
      const provider = await den.getOrgLlmProviderConnection(orgId, cloudProviderId);
      const localProviderId = getCloudManagedProviderId(provider);
      assertProviderAllowedByDesktopPolicy(localProviderId);
      const existingImported = state.importedCloudProviders[cloudProviderId] ?? null;
      const { envEntries, primaryApiKey } = resolveCloudProviderCredentials(provider);
      const env = getCloudProviderEnv(provider.providerConfig);
      if (!primaryApiKey && env.length > 0) {
        throw new CloudProviderNeedsCredentialError(
          `${provider.name} does not have a stored organization credential yet.`,
        );
      }

View on GitHub (pinned to 2b7df46e8a)

Solutions

  1. Sign in to OpenWork Cloud and select an organization in Settings before triggering cloud provider actions.
  2. Check readDenSettings() output for authToken and activeOrgId before invoking the action.
  3. Re-run the sign-in flow if the token was cleared or expired.
  4. Ensure the correct settings profile/config file is being loaded.

Example fix

// before
await store.pushDenSession(); // throws without token/org
// after
const s = readDenSettings();
if (!s.authToken?.trim() || !s.activeOrgId?.trim()) {
  await openCloudSignInDialog();
  return;
}
await store.pushDenSession();
Defensive patterns

Strategy: validation

Validate before calling

const s = readDenSettings();
const authed = Boolean(s.authToken?.trim()) && Boolean(s.activeOrgId?.trim());
if (!authed) openCloudSignInDialog();

Type guard

function isDenAuthenticated(s: { authToken?: string | null; activeOrgId?: string | null }): boolean {
  return Boolean(s.authToken?.trim()) && Boolean(s.activeOrgId?.trim());
}

Try / catch

try {
  await store.pushDenSession();
} catch (e) {
  if (String((e as Error).message).includes("Sign in to OpenWork Cloud")) {
    startCloudSignInFlow();
  }
}

Prevention

When it happens

Trigger: Calling the Den push/sync action before signing in to OpenWork Cloud, after signing out (token cleared), or when no organization has been selected so activeOrgId is empty.

Common situations: Fresh install with no Den sign-in; token expired/cleared from settings; user picked a server but never chose an org; settings file read from the wrong profile.

Related errors


AI-assisted analysis of different-ai/openwork@2b7df46e8a (2026-09-01). Data as JSON: /api/errors/905c3868fc4ff2fd. Report an issue: GitHub.