{"record":{"id":"f0d1a05e3e2fde3b","repo":"different-ai/openwork","slug":"t-providers-custom-providers-disabled","errorCode":null,"errorMessage":"t(\"providers.custom_providers_disabled\")","messagePattern":"t\\(\"providers\\.custom_providers_disabled\"\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"apps/app/src/react-app/domains/connections/provider-auth/store.ts","lineNumber":2219,"sourceCode":"      checkRestriction: options.checkDesktopAppRestriction,\n    });\n  }\n\n  async function openProviderAuthModal(optionsArg?: {\n    returnFocusTarget?: ProviderReturnFocusTarget;\n    preferredProviderId?: string;\n  }) {\n    if (isProviderAddRestricted(optionsArg?.preferredProviderId)) {\n      const message = t(\"providers.custom_providers_disabled\");\n      mutateState((current) => ({\n        ...current,\n        providerAuthReturnFocusTarget: \"none\",\n        providerAuthPreferredProviderId: null,\n        providerAuthBusy: false,\n        providerAuthModalOpen: false,\n        providerAuthError: message,\n      }));\n      throw new Error(message);\n    }\n\n    mutateState((current) => ({\n      ...current,\n      providerAuthReturnFocusTarget: optionsArg?.returnFocusTarget ?? \"none\",\n      providerAuthPreferredProviderId: optionsArg?.preferredProviderId?.trim() || null,\n      providerAuthBusy: true,\n      providerAuthError: null,\n    }));\n\n    try {\n      const methods = await loadProviderAuthMethods(getProviderAuthWorkerType());\n      mutateState((current) => ({\n        ...current,\n        providerAuthMethods: methods,\n        providerAuthModalOpen: true,\n      }));\n    } catch (error) {","sourceCodeStart":2201,"sourceCodeEnd":2237,"githubUrl":"https://github.com/different-ai/openwork/blob/2b7df46e8ae1517d64c896c7793d2d52ec845669/apps/app/src/react-app/domains/connections/provider-auth/store.ts#L2201-L2237","documentation":"openProviderAuthModal throws the localized 'providers.custom_providers_disabled' message when isProviderAddRestricted(...) is true, i.e. a desktop policy restricts adding the requested provider. Before throwing, it resets the auth modal state and stores the message in providerAuthError so the UI can display why the modal did not open.","triggerScenarios":"Calling openProviderAuthModal (optionally with preferredProviderId) when options.checkDesktopAppRestriction reports the provider as restricted by desktop policy — org-managed devices can forbid adding custom providers.","commonSituations":"Users on org-managed desktops trying to add an arbitrary/custom model provider; a policy pushed by OpenWork Den that blocks custom provider additions; testing the modal with a provider id covered by the restriction list.","solutions":["Ask the org admin to relax the desktop-app provider restriction policy","Open the modal with a provider id that is not restricted (preferredProviderId of an allowed provider)","Handle the thrown error / providerAuthError in the UI and show an 'admin disabled custom providers' notice","Verify checkDesktopAppRestriction wiring is not over-restricting (false-positive policy match)"],"exampleFix":"// before\nawait openProviderAuthModal({ preferredProviderId: \"my-custom-provider\" });\n// after\nif (isProviderAddRestrictedByDesktopPolicy({ providerId: \"my-custom-provider\", checkRestriction })) {\n  showError(t(\"providers.custom_providers_disabled\"));\n} else {\n  await openProviderAuthModal({ preferredProviderId: \"my-custom-provider\" });\n}","handlingStrategy":"validation","validationCode":"if (isProviderAddRestrictedByDesktopPolicy({ providerId, checkRestriction: checkDesktopAppRestriction })) {\n  showToast(t(\"providers.custom_providers_disabled\"));\n  return;\n}","typeGuard":"function canAddProvider(id: string | undefined): boolean {\n  return !isProviderAddRestrictedByDesktopPolicy({ providerId: id, checkRestriction });\n}","tryCatchPattern":"try {\n  await openProviderAuthModal({ preferredProviderId: id });\n} catch (err) {\n  if (err.message === t(\"providers.custom_providers_disabled\")) {\n    showPolicyBlockedNotice();\n  } else throw err;\n}","preventionTips":["Check desktop policy restrictions before rendering 'add provider' affordances","Surface providerAuthError state in the UI so policy blocks are visible","Keep org policy docs handy; restriction comes from Den-managed desktop policy","Catch this error where the modal is opened so the app never crashes on restricted providers"],"tags":["policy","desktop","restriction","provider","localization"],"backgroundTag":"policy-restriction-blocked","analyzedSha":"2b7df46e8ae1517d64c896c7793d2d52ec845669","analyzedAt":"2026-09-01T07:59:23.713Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}