different-ai/openwork · error
t("providers.not_connected")
Error message
t("providers.not_connected") What it means
loadProviderAuthMethods fetches the available provider auth methods from the connected opencode server via c.provider.auth(). If options.client() returns null there is no server connection at all, so the store throws providers.not_connected before any request is made. This is the store's way of saying "connect to a server first".
Source
Thrown at apps/app/src/react-app/domains/connections/provider-auth/store.ts:1383
if (!isOpenAiProvider) continue;
merged[id] = providerMethods.filter((method) => {
if (method.type !== "oauth") return true;
// Browser mode can't complete the ChatGPT sign-in flows, so only API keys
// are offered off-desktop.
if (!isDesktopRuntime()) return false;
const label = method.label.toLowerCase();
const isHeadless = /headless|device/.test(label);
return workerType === "remote" ? isHeadless : !isHeadless;
});
}
return merged;
};
const loadProviderAuthMethods = async (workerType: "local" | "remote") => {
const c = options.client();
if (!c) {
throw new Error(t("providers.not_connected"));
}
const methods = unwrap(await c.provider.auth());
return buildProviderAuthMethods(
methods as Record<string, ProviderAuthMethod[]>,
getProviderAuthProviders(),
workerType,
);
};
async function startProviderAuth(
providerId?: string,
methodIndex?: number,
): Promise<ProviderOAuthStartResult> {
setStateField("providerAuthError", null);
const c = options.client();
if (!c) {
throw new Error(t("providers.not_connected"));
}View on GitHub (pinned to 2b7df46e8a)
Solutions
- Start/connect the opencode server (or launch via pnpm world up dev-headless) before loading provider auth methods.
- Re-establish the client connection and retry; ensure options.client() resolves to a live client.
- Check initialization order so UI screens call this only after the connection is ready.
- If the connection was dropped, reconnect the session and re-open the connections panel.
Defensive patterns
Strategy: validation
Validate before calling
const client = options.client();
if (!client) {
showToast(t("providers.not_connected"));
return;
}
await loadProviderAuthMethods(workerType); Type guard
function hasClient<T>(client: T | null | undefined): client is T {
return client != null;
} Try / catch
try {
await store.loadProviderAuthMethods("local");
} catch (e) {
if (e instanceof Error && /not.?connected/i.test(e.message)) {
openConnectDialog();
} else throw e;
} Prevention
- Gate provider screens/actions behind connection-ready state.
- Show a 'Connect to server' empty state instead of calling the store when client is null.
- Re-load auth methods after any reconnect event.
- Subscribe to connection status in Zustand and disable provider controls when disconnected.
When it happens
Trigger: Calling loadProviderAuthMethods (directly or via startProviderOAuth when the providerAuthMethods cache is empty) while options.client() returns null — i.e. the app has no active server/client session.
Common situations: App started before the local openwork-server is up; server connection dropped or the session was closed; opening the providers/connections screen before sign-in; client factory (options.client) not wired to a live connection.
Related errors
- t("providers.no_providers_available")
- t("providers.provider_id_required")
- `${t("providers.unknown_provider")}: ${resolved}`
- `${t("providers.no_oauth_prefix")} ${resolved}. ${t("provide
- OpenWork server unavailable.
AI-assisted analysis of different-ai/openwork@2b7df46e8a (2026-09-01).
Data as JSON: /api/errors/c5e3200096212b8d.
Report an issue: GitHub.