{"record":{"id":"1b561d88939552b4","repo":"meteor/meteor","slug":"accounts-ui-config-can-t-set-requestpermissions","errorCode":null,"errorMessage":"Accounts.ui.config: Can't set `requestPermissions` more than once for ${service}","messagePattern":"Accounts\\.ui\\.config: Can't set `requestPermissions` more than once for (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/accounts-ui-unstyled/accounts_ui.js","lineNumber":165,"sourceCode":"export function passwordlessSignupFields() {\n  const { passwordlessSignupFields } = Accounts.ui._options;\n\n  if (Array.isArray(passwordlessSignupFields)) {\n    return passwordlessSignupFields;\n  }\n\n  if (typeof passwordlessSignupFields === 'string') {\n    return [passwordlessSignupFields];\n  }\n\n  return ['EMAIL_ONLY'];\n}\n\nfunction handleRequestPermissions({ requestPermissions }) {\n  if (requestPermissions) {\n    Object.keys(requestPermissions).forEach(service => {\n      if (Accounts.ui._options.requestPermissions[service]) {\n        throw new Error(\n          `Accounts.ui.config: Can't set \\`requestPermissions\\` more than once for ${service}`\n        );\n      }\n\n      const scope = requestPermissions[service];\n\n      if (!Array.isArray(scope)) {\n        throw new Error(\n          'Accounts.ui.config: Value for `requestPermissions` must be an array'\n        );\n      }\n\n      Accounts.ui._options.requestPermissions[service] = scope;\n    });\n  }\n}\n\nfunction handleRequestOfflineToken({ requestOfflineToken }) {","sourceCodeStart":147,"sourceCodeEnd":183,"githubUrl":"https://github.com/meteor/meteor/blob/5076d2f818d3cac01d0cf8312fa5b2332076a4fb/packages/accounts-ui-unstyled/accounts_ui.js#L147-L183","documentation":"handleRequestPermissions throws if Accounts.ui._options.requestPermissions[service] is already truthy when config supplies requestPermissions for the same service again. Each external service's permission scope can only be configured once.","triggerScenarios":"Calling Accounts.ui.config({ requestPermissions: { google: [...] } }) twice with the same service key; or settings + code both defining the same service.","commonSituations":"Two config calls in different files targeting the same OAuth service. Adding a new service and accidentally re-declaring an existing one's permissions.","solutions":["Declare each service's requestPermissions exactly once.","Merge all service permissions into a single config call.","Remove duplicate declarations across settings and code."],"exampleFix":"// before\nAccounts.ui.config({ requestPermissions: { google: ['profile'] } });\nAccounts.ui.config({ requestPermissions: { google: ['email'] } });\n\n// after — single merged call\nAccounts.ui.config({ requestPermissions: { google: ['profile', 'email'] } });","handlingStrategy":"validation","validationCode":"function mergeRequestPermissions(newPerms) {\n  const existing = Accounts.ui._options.requestPermissions;\n  const merged = { ...existing };\n  for (const svc of Object.keys(newPerms)) {\n    if (existing[svc]) continue; // skip already-configured services\n    merged[svc] = newPerms[svc];\n  }\n  return merged;\n}","typeGuard":"const isServiceConfigured = (svc) => Boolean(Accounts.ui._options.requestPermissions[svc]);","tryCatchPattern":null,"preventionTips":["Declare all services' requestPermissions in one Accounts.ui.config call.","Track which services are already configured before adding new ones."],"tags":["accounts-ui","configuration","oauth","duplicate-config"],"backgroundTag":null,"analyzedSha":"5076d2f818d3cac01d0cf8312fa5b2332076a4fb","analyzedAt":"2026-08-13T03:27:40.142Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}