RocketChat/Rocket.Chat · error · Meteor.Error

could-not-access-webdav

could-not-access-webdav

Error message

Could not access webdav

What it means

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.

Source

Thrown at apps/meteor/server/bridges/webdav/methods/getWebdavFileList.ts:44

			throw new Meteor.Error('error-not-allowed', 'WebDAV Integration Not Allowed', {
				method: 'getWebdavFileList',
			});
		}

		const account = await WebdavAccounts.findOneByIdAndUserId(accountId, userId, {});
		if (!account) {
			throw new Meteor.Error('error-invalid-account', 'Invalid WebDAV Account', {
				method: 'getWebdavFileList',
			});
		}

		try {
			const cred = getWebdavCredentials(account);
			const client = new WebdavClientAdapter(account.serverURL, cred);
			const data = (await client.getDirectoryContents(path)) as IWebdavNode[];
			return { success: true, data };
		} catch (error) {
			throw new Meteor.Error('could-not-access-webdav', 'Could not access webdav', {
				method: 'getWebdavFileList',
			});
		}
	},
});

View on GitHub (pinned to b2c16d5842)

Solutions

  1. From the Rocket.Chat server, curl the account's serverURL to confirm it resolves and TLS is valid
  2. Re-authorize the WebDAV account to refresh the stored OAuth token
  3. Verify the path argument exists on the WebDAV server
  4. If the stored serverURL is wrong, delete and re-create the account with the correct URL

Example fix

// before
const { data } = await Meteor.callAsync('getWebdavFileList', accountId, path);

// after - distinguish transient network failures from config problems
try {
  const { data } = await Meteor.callAsync('getWebdavFileList', accountId, path);
} catch (e: any) {
  if (e?.error === 'could-not-access-webdav') {
    // check server reachability, then prompt re-authorization (token may be stale)
  }
}
Defensive patterns

Strategy: try-catch

Try / catch

async function listWithRetry(accountId: string, path: string, tries = 2) {
  for (let i = 0; i <= tries; i++) {
    try {
      return await Meteor.callAsync('getWebdavFileList', accountId, path);
    } catch (e: any) {
      if (e?.error !== 'could-not-access-webdav' || i === tries) throw e;
      await new Promise((r) => setTimeout(r, 500 * 2 ** i));
    }
  }
  throw new Error('unreachable');
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: 'Something went wrong' / 'Request failed (500)' / 'HTTP error! status: 404' — what failed HTTP requests actually mean and how to find the real cause — this error's family across 28 libraries.

Related errors


AI-assisted analysis of RocketChat/Rocket.Chat@b2c16d5842 (2026-08-18). Data as JSON: /api/errors/a5d2c512feed7244. Report an issue: GitHub.