{"record":{"id":"2ba5f82cf53662cc","repo":"RocketChat/Rocket.Chat","slug":"error-invalid-user-2ba5f8","errorCode":"error-invalid-user","errorMessage":"Invalid User","messagePattern":"Invalid User","errorType":"error_code","errorClass":"Meteor.Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/server/bridges/webdav/methods/getWebdavFileList.ts","lineNumber":22,"sourceCode":"import { Meteor } from 'meteor/meteor';\n\nimport { settings } from '../../../settings';\nimport { getWebdavCredentials } from '../lib/getWebdavCredentials';\nimport { WebdavClientAdapter } from '../lib/webdavClientAdapter';\n\ndeclare module '@rocket.chat/ddp-client' {\n\t// eslint-disable-next-line @typescript-eslint/naming-convention\n\tinterface ServerMethods {\n\t\tgetWebdavFileList(accountId: IWebdavAccount['_id'], path: string): { success: boolean; data: IWebdavNode[] };\n\t}\n}\n\nMeteor.methods<ServerMethods>({\n\tasync getWebdavFileList(accountId, path) {\n\t\tconst userId = Meteor.userId();\n\n\t\tif (!userId) {\n\t\t\tthrow new Meteor.Error('error-invalid-user', 'Invalid User', { method: 'getWebdavFileList' });\n\t\t}\n\n\t\tif (!settings.get('Webdav_Integration_Enabled')) {\n\t\t\tthrow new Meteor.Error('error-not-allowed', 'WebDAV Integration Not Allowed', {\n\t\t\t\tmethod: 'getWebdavFileList',\n\t\t\t});\n\t\t}\n\n\t\tconst account = await WebdavAccounts.findOneByIdAndUserId(accountId, userId, {});\n\t\tif (!account) {\n\t\t\tthrow new Meteor.Error('error-invalid-account', 'Invalid WebDAV Account', {\n\t\t\t\tmethod: 'getWebdavFileList',\n\t\t\t});\n\t\t}\n\n\t\ttry {\n\t\t\tconst cred = getWebdavCredentials(account);\n\t\t\tconst client = new WebdavClientAdapter(account.serverURL, cred);","sourceCodeStart":4,"sourceCodeEnd":40,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/server/bridges/webdav/methods/getWebdavFileList.ts#L4-L40","documentation":"getWebdavFileList is the DDP method that lists a directory on one of the user's connected WebDAV accounts. It throws error-invalid-user when Meteor.userId() is falsy — the calling connection is not authenticated. The check runs before the integration, account, and listing steps, so unauthenticated calls never reach the WebDAV server.","triggerScenarios":"Calling Meteor.call('getWebdavFileList', accountId, path) on a DDP connection without a valid login — expired token in a file browser, or an unauthenticated script/tool.","commonSituations":"File browsers opened in tabs whose session expired; automation listing WebDAV files without DDP login; server code invoking the method without a bound user.","solutions":["Authenticate the DDP connection before listing","Re-login when the session is stale, then retry","Gate file-picker mounting on a live-session check"],"exampleFix":"// before\nMeteor.call('getWebdavFileList', accountId, path); // → error-invalid-user\n\n// after\nif (!Meteor.userId()) await relogin();\nMeteor.call('getWebdavFileList', accountId, path, (err) => { /* handle */ });","handlingStrategy":"validation","validationCode":"if (!Meteor.userId()) {\n  await relogin();\n}\nawait Meteor.callAsync('getWebdavFileList', accountId, path);","typeGuard":null,"tryCatchPattern":"Meteor.call('getWebdavFileList', accountId, path, (err) => {\n  if (err && err.error === 'error-invalid-user') {\n    // session expired: re-login, then re-list\n  }\n});","preventionTips":["Mount WebDAV browsers only in authenticated sessions","Re-login on session expiry rather than retrying the listing","Keep file pickers short-lived to avoid stale sessions"],"tags":["meteor","webdav","authentication","file-listing"],"backgroundTag":"meteor-error-invalid-user","analyzedSha":"b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0","analyzedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}