RocketChat/Rocket.Chat · error · Meteor.Error

could-not-access-webdav

could-not-access-webdav

Error message

Could not access webdav

What it means

This is a catch-all around the token-based WebDAV account flow: constructing/authenticating the WebDAV client with the OAuth token, upserting the account into WebdavAccounts, and broadcasting the change. Any failure inside that try block is swallowed and rethrown as the generic could-not-access-webdav Meteor.Error, so the real cause (unreachable serverURL, expired/invalid access token, TLS failure, or even a DB write error) is not visible to the client.

Solutions

  1. Verify the endpoint is live WebDAV before saving: curl -X OPTIONS <serverURL> (expect 2xx and WebDAV headers)
  2. Re-run the OAuth authorization to get a fresh access token, then retry the save
  3. Check the Rocket.Chat server logs/stderr — the original exception is swallowed by this catch and only visible server-side
  4. Confirm proxies/firewalls allow the WebDAV verbs (OPTIONS, PROPFIND) from the Rocket.Chat host

Example fix

// before — save directly, generic error on failure
await call('addWebdavAccountByToken', data); // → could-not-access-webdav

// after — pre-flight the server, then save
const probe = await fetch(data.serverURL, { method: 'OPTIONS' });
if (!probe.ok) throw new Error(`WebDAV server unreachable (HTTP ${probe.status})`);
await call('addWebdavAccountByToken', data);
Defensive patterns

Strategy: try-catch

Validate before calling

// pre-flight the WebDAV endpoint before saving the account
const probe = await fetch(data.serverURL, { method: 'OPTIONS' });
if (!probe.ok) throw new Error(`WebDAV server not reachable (HTTP ${probe.status})`);
await call('addWebdavAccountByToken', data);

Try / catch

try {
  await Meteor.callAsync('addWebdavAccountByToken', data);
} catch (e) {
  if (e.error === 'could-not-access-webdav') {
    // original cause is swallowed server-side: check serverURL reachability,
    // refresh the OAuth token, and inspect Rocket.Chat server logs
  }
}

Prevention

When it happens

Trigger: Calling addWebdavAccountByToken with a serverURL that is not a reachable WebDAV endpoint; an OAuth access token that is expired or was issued for a different user/scope; network or proxy blocking WebDAV verbs; a database failure during the upsert.

Common situations: OAuth token expired between authorization and account save; serverURL typo or pointing at a plain HTTPS page instead of a WebDAV endpoint; corporate proxies stripping PROPFIND/OPTIONS; self-signed certificates rejected by the server-side client.

Related errors


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

Appendix: source

Thrown at apps/meteor/server/bridges/webdav/methods/addWebdavAccount.ts:72

		await WebdavAccounts.updateOne(
			{
				userId,
				serverURL: data.serverURL,
				name: data.name ?? '',
			},
			{
				$set: accountData,
			},
			{
				upsert: true,
			},
		);
		void api.broadcast('notify.webdav', userId, {
			type: 'changed',
			account: accountData,
		});
	} catch (error) {
		throw new Meteor.Error('could-not-access-webdav', 'Could not access webdav', {
			method: 'addWebdavAccount',
		});
	}

	return true;
};

Meteor.methods<ServerMethods>({
	async addWebdavAccount(formData) {
		const userId = Meteor.userId();

		if (!userId) {
			throw new Meteor.Error('error-invalid-user', 'Invalid User', { method: 'addWebdavAccount' });
		}

		if (!settings.get('Webdav_Integration_Enabled')) {
			throw new Meteor.Error('error-not-allowed', 'WebDAV Integration Not Allowed', {
				method: 'addWebdavAccount',

View on GitHub (pinned to b2c16d5842)