{"record":{"id":"d9c6f5470948beee","repo":"RocketChat/Rocket.Chat","slug":"error-action-not-allowed-d9c6f5","errorCode":"error-action-not-allowed","errorMessage":"Auto-Translate is not allowed","messagePattern":"Auto-Translate is not allowed","errorType":"exception","errorClass":"Meteor.Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/server/lib/autotranslate/functions/getSupportedLanguages.ts","lineNumber":13,"sourceCode":"import { Meteor } from 'meteor/meteor';\n\nimport { settings } from '../../../settings';\nimport { hasPermissionAsync } from '../../authorization/hasPermission';\nimport { TranslationProviderRegistry } from '../index';\n\nexport const getSupportedLanguages = async (userId: string, targetLanguage: string) => {\n\tif (!settings.get('AutoTranslate_Enabled')) {\n\t\tthrow new Meteor.Error('error-autotranslate-disabled', 'Auto-Translate is disabled');\n\t}\n\n\tif (!(await hasPermissionAsync(userId, 'auto-translate'))) {\n\t\tthrow new Meteor.Error('error-action-not-allowed', 'Auto-Translate is not allowed', {\n\t\t\tmethod: 'autoTranslate.getSupportedLanguages',\n\t\t});\n\t}\n\n\treturn TranslationProviderRegistry.getSupportedLanguages(targetLanguage);\n};\n","sourceCodeStart":1,"sourceCodeEnd":20,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/server/lib/autotranslate/functions/getSupportedLanguages.ts#L1-L20","documentation":"Thrown when a user without the 'auto-translate' permission calls 'autoTranslate.getSupportedLanguages' (DDP). The REST twin enforces authentication only, so this surfaces mainly on the DDP path through the shared lib. Auto-Translate is not granted to all roles by default; it must be added to a role the user holds.","triggerScenarios":"A regular user opens the translate UI without the 'auto-translate' permission; a custom role created without it; the permission revoked while the user's client keeps polling languages.","commonSituations":"Admins enable the AutoTranslate_Enabled setting but forget to grant the permission to user/admin roles; bots or federation users lacking the permission.","solutions":["Grant 'auto-translate' to the roles that need it under Administration > Permissions","Check the user's effective permissions before exposing the translate UI","Catch the error and hide the translate option instead of erroring on every poll"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const me = await GET '/api/v1/me';\nif (!me.permissions?.includes('auto-translate')) {\n  // do not call autoTranslate.getSupportedLanguages for this user\n}","typeGuard":null,"tryCatchPattern":"try {\n  await call('autoTranslate.getSupportedLanguages', targetLanguage);\n} catch (e) {\n  if (e instanceof Meteor.Error && e.error === 'error-action-not-allowed') {\n    // user lacks the 'auto-translate' permission - hide the feature\n  } else {\n    throw e;\n  }\n}","preventionTips":["Check the user's permission list before rendering translate controls","Cache the permission result instead of re-triggering failing calls","When enabling Auto-Translate, also assign the permission to the target roles"],"tags":["rocket-chat","autotranslate","authorization","rbac"],"backgroundTag":"permission-denied","analyzedSha":"b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0","analyzedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}