{"record":{"id":"a5d2c512feed7244","repo":"RocketChat/Rocket.Chat","slug":"could-not-access-webdav-a5d2c5","errorCode":"could-not-access-webdav","errorMessage":"Could not access webdav","messagePattern":"Could not access webdav","errorType":"error_code","errorClass":"Meteor.Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/server/bridges/webdav/methods/getWebdavFileList.ts","lineNumber":44,"sourceCode":"\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);\n\t\t\tconst data = (await client.getDirectoryContents(path)) as IWebdavNode[];\n\t\t\treturn { success: true, data };\n\t\t} catch (error) {\n\t\t\tthrow new Meteor.Error('could-not-access-webdav', 'Could not access webdav', {\n\t\t\t\tmethod: 'getWebdavFileList',\n\t\t\t});\n\t\t}\n\t},\n});\n","sourceCodeStart":26,"sourceCodeEnd":50,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/server/bridges/webdav/methods/getWebdavFileList.ts#L26-L50","documentation":"Generic wrapper for any failure of the webdav-client getDirectoryContents(path) request inside getWebdavFileList. The server successfully built credentials and a WebdavClientAdapter from the stored account, but the HTTP call to the WebDAV server failed: network error, DNS failure, TLS problem, 401/403 from an expired token, or a nonexistent path. The original error is swallowed, so only this code surfaces.","triggerScenarios":"Nextcloud/WebDAV server unreachable from the Rocket.Chat server (DNS, firewall, bad TLS); the stored OAuth access token expired or was revoked so the PROPFIND returns 401; the requested path does not exist on the server; the account's serverURL has a typo or wrong scheme.","commonSituations":"Self-hosted Nextcloud not reachable from the app server; token revoked when the user changed their Nextcloud password; reverse-proxy TLS misconfiguration; account created against a URL that later moved.","solutions":["From the Rocket.Chat server, curl the account's serverURL to confirm it resolves and TLS is valid","Re-authorize the WebDAV account to refresh the stored OAuth token","Verify the path argument exists on the WebDAV server","If the stored serverURL is wrong, delete and re-create the account with the correct URL"],"exampleFix":"// before\nconst { data } = await Meteor.callAsync('getWebdavFileList', accountId, path);\n\n// after - distinguish transient network failures from config problems\ntry {\n  const { data } = await Meteor.callAsync('getWebdavFileList', accountId, path);\n} catch (e: any) {\n  if (e?.error === 'could-not-access-webdav') {\n    // check server reachability, then prompt re-authorization (token may be stale)\n  }\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"async function listWithRetry(accountId: string, path: string, tries = 2) {\n  for (let i = 0; i <= tries; i++) {\n    try {\n      return await Meteor.callAsync('getWebdavFileList', accountId, path);\n    } catch (e: any) {\n      if (e?.error !== 'could-not-access-webdav' || i === tries) throw e;\n      await new Promise((r) => setTimeout(r, 500 * 2 ** i));\n    }\n  }\n  throw new Error('unreachable');\n}","preventionTips":["Health-check the WebDAV serverURL from the app server (curl) when the account is created, so typos are caught early","Re-authorize accounts proactively when users change their Nextcloud password","Log the accountId and path when this fires — the server swallows the underlying HTTP error, so context is your only clue"],"tags":["webdav","network","http","oauth-token"],"backgroundTag":"http-request-failed","analyzedSha":"b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0","analyzedAt":"2026-08-18T15:26:39.429Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}