{"record":{"id":"af1184591c0d146a","repo":"RocketChat/Rocket.Chat","slug":"error-not-allowed-af1184","errorCode":"error-not-allowed","errorMessage":"Threads Disabled","messagePattern":"Threads Disabled","errorType":"exception","errorClass":"Meteor.Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/server/meteor-methods/messages/readThreads.ts","lineNumber":27,"sourceCode":"import { methodDeprecationLogger } from '../../lib/deprecationWarningLogger';\nimport { readThread } from '../../lib/messaging/threads/functions';\nimport { settings } from '../../settings';\n\ndeclare module '@rocket.chat/ddp-client' {\n\t// eslint-disable-next-line @typescript-eslint/naming-convention\n\tinterface ServerMethods {\n\t\treadThreads(tmid: IMessage['_id']): void;\n\t}\n}\n\nMeteor.methods<ServerMethods>({\n\tasync readThreads(tmid) {\n\t\tmethodDeprecationLogger.method('readThreads', '9.0.0', '/v1/chat.readThread');\n\n\t\tcheck(tmid, String);\n\n\t\tif (!Meteor.userId() || !settings.get('Threads_enabled')) {\n\t\t\tthrow new Meteor.Error('error-not-allowed', 'Threads Disabled', {\n\t\t\t\tmethod: 'getThreadMessages',\n\t\t\t});\n\t\t}\n\n\t\tconst thread = await Messages.findOneById(tmid);\n\t\tif (!thread) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst user = (await Meteor.userAsync()) ?? undefined;\n\n\t\tconst room = await Rooms.findOneById(thread.rid);\n\t\tif (!room) {\n\t\t\tthrow new Meteor.Error('error-room-does-not-exist', 'This room does not exist', { method: 'getThreadMessages' });\n\t\t}\n\n\t\tif (!(await canAccessRoomAsync(room, user))) {\n\t\t\tthrow new Meteor.Error('error-not-allowed', 'Not allowed', { method: 'getThreadMessages' });","sourceCodeStart":9,"sourceCodeEnd":45,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/server/meteor-methods/messages/readThreads.ts#L9-L45","documentation":"The readThreads Meteor method (deprecated since 9.0.0 in favor of POST /v1/chat.readThread) throws error-not-allowed with message 'Threads Disabled' when either the connection is not authenticated (Meteor.userId() is null) or the workspace setting Threads_enabled is false. Both conditions share one guard, so an unauthenticated call is also reported as 'Threads Disabled', which can mislead debugging.","triggerScenarios":"Meteor.call('readThreads', tmid) while Threads are disabled in Admin -> Workspace -> Threads; the same call from a logged-out DDP connection; test/CI environments running against a fresh database where the Threads_enabled setting was never seeded or explicitly enabled.","commonSituations":"Workspace admin disabled threads but clients still ship thread UI; upgrade or migration reset the setting to its default; bot or script that never performed a DDP login; automated tests hitting a blank Mongo database.","solutions":["Enable threads: Admin -> Workspace -> Threads (the Threads_enabled setting must be true)","Ensure the DDP connection is authenticated before calling (Meteor.userId() must return an id)","Migrate to the supported REST endpoint POST /v1/chat.readThread, the non-deprecated replacement in 9.0.0+"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// client: gate thread reads on auth + the public Threads_enabled setting\nconst threadsEnabled = useSetting('Threads_enabled');\nif (Meteor.userId() && threadsEnabled) {\n\tawait Meteor.callAsync('readThreads', tmid);\n}","typeGuard":null,"tryCatchPattern":"try {\n\tawait Meteor.callAsync('readThreads', tmid);\n} catch (e: any) {\n\tif (e?.error === 'error-not-allowed' && e?.reason === 'Threads Disabled') {\n\t\t// threads off OR not logged in: hide thread UI, no retry\n\t\treturn;\n\t}\n\tthrow e;\n}","preventionTips":["Read Threads_enabled from the settings subscription before rendering thread UI","Check Meteor.userId() before any thread method call since both conditions share this error","Migrate to POST /v1/chat.readThread; the Meteor method is deprecated in 9.0.0"],"tags":["meteor-method","threads","settings","deprecated","authentication"],"backgroundTag":"feature-flag-disabled","analyzedSha":"b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0","analyzedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}