{"record":{"id":"a46d365c536d4671","repo":"different-ai/openwork","slug":"t-providers-no-providers-available","errorCode":null,"errorMessage":"t(\"providers.no_providers_available\")","messagePattern":"t\\(\"providers\\.no_providers_available\"\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"apps/app/src/react-app/domains/connections/provider-auth/store.ts","lineNumber":1409,"sourceCode":"  };\n\n  async function startProviderAuth(\n    providerId?: string,\n    methodIndex?: number,\n  ): Promise<ProviderOAuthStartResult> {\n    setStateField(\"providerAuthError\", null);\n    const c = options.client();\n    if (!c) {\n      throw new Error(t(\"providers.not_connected\"));\n    }\n    try {\n      const cachedMethods = state.providerAuthMethods;\n      const authMethods = Object.keys(cachedMethods).length\n        ? cachedMethods\n        : await loadProviderAuthMethods(getProviderAuthWorkerType());\n      const providerIds = Object.keys(authMethods).sort();\n      if (!providerIds.length) {\n        throw new Error(t(\"providers.no_providers_available\"));\n      }\n\n      const resolved = providerId?.trim() ?? \"\";\n      if (!resolved) {\n        throw new Error(t(\"providers.provider_id_required\"));\n      }\n      assertProviderAllowedByDesktopPolicy(resolved);\n\n      const methods = authMethods[resolved];\n      if (!methods || !methods.length) {\n        throw new Error(`${t(\"providers.unknown_provider\")}: ${resolved}`);\n      }\n\n      const oauthIndex =\n        methodIndex !== undefined\n          ? methodIndex\n          : methods.find((method) => method.type === \"oauth\")?.methodIndex ?? -1;\n      if (oauthIndex === -1) {","sourceCodeStart":1391,"sourceCodeEnd":1427,"githubUrl":"https://github.com/different-ai/openwork/blob/2b7df46e8ae1517d64c896c7793d2d52ec845669/apps/app/src/react-app/domains/connections/provider-auth/store.ts#L1391-L1427","documentation":"After loading provider auth methods, startProviderOAuth sorts the provider IDs from the server's response; if the map is empty the store throws providers.no_providers_available. The server is connected (otherwise error 42 fires first), but it reports zero providers that support auth. This signals a server-side configuration issue: no providers are configured/enabled on the connected instance.","triggerScenarios":"Calling startProviderOAuth (or loadProviderAuthMethods with an empty cache) on a connected client whose c.provider.auth() returns an empty Record — Object.keys(authMethods).length === 0.","commonSituations":"Fresh/self-hosted opencode server with no provider configs (no config.json providers, no env API keys); remote worker type with providers configured only locally; server config stripped providers from the auth method list; wrong server/project connected that has no providers set up.","solutions":["Configure at least one provider on the opencode server (provider config or provider auth entries) and retry.","Verify you are connected to the intended server/project — a misrouted connection may point at an unconfigured instance.","Check the workerType ('local' vs 'remote'): providers configured for the other worker type will not appear.","Inspect c.provider.auth() output directly to confirm what the server returns."],"exampleFix":"// before: empty server config\n{ \"$schema\": \".../config.json\" }\n// after: configure a provider\n{ \"provider\": { \"anthropic\": { \"api\": { \"type\": \"anthropic\" } } } }","handlingStrategy":"validation","validationCode":"const methods = await store.loadProviderAuthMethods(workerType);\nif (Object.keys(methods).length === 0) {\n  showToast(\"No providers are configured on this server. Add a provider in opencode config first.\");\n  return;\n}","typeGuard":"function hasProviders(m: Record<string, unknown>): m is Record<string, unknown[]> & { length: never } {\n  return Object.keys(m).length > 0;\n}\n// use: if (!hasProviders(authMethods)) { ... return; }","tryCatchPattern":"try {\n  await store.startProviderOAuth(providerId);\n} catch (e) {\n  if (e instanceof Error && /no providers available/i.test(e.message)) {\n    openProviderSetupGuide();\n  } else throw e;\n}","preventionTips":["Configure at least one provider in the opencode server config before wiring auth UI.","Verify local vs remote workerType matches where providers are configured.","Confirm you connected to the intended server/project.","Render an empty-state 'no providers configured' screen when the method map is empty."],"tags":["configuration","provider-auth","server-config"],"backgroundTag":"no-providers-configured","analyzedSha":"2b7df46e8ae1517d64c896c7793d2d52ec845669","analyzedAt":"2026-09-01T07:59:23.713Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}