RocketChat/Rocket.Chat · error · Meteor.Error
unable-to-get-file
unable-to-get-file
Error message
Unable to get file
What it means
Catch-all around the actual file transfer in getFileFromWebdav: building credentials from the account, constructing the WebDAV client, and client.getFileContents(file.filename). Any failure is rethrown as unable-to-get-file, so a missing file, a permissions change on the WebDAV server, expired stored credentials, or a mid-transfer network error all surface identically. The original exception is not attached, so diagnosis must happen on the WebDAV server side.
Source
Thrown at apps/meteor/server/bridges/webdav/methods/getFileFromWebdav.ts:44
method: 'getFileFromWebdav',
});
}
const account = await WebdavAccounts.findOneByIdAndUserId(accountId, userId, {});
if (!account) {
throw new Meteor.Error('error-invalid-account', 'Invalid WebDAV Account', {
method: 'getFileFromWebdav',
});
}
try {
const cred = getWebdavCredentials(account);
const client = new WebdavClientAdapter(account.serverURL, cred);
const fileContent = await client.getFileContents(file.filename);
const data = new Uint8Array(fileContent);
return { success: true, data };
} catch (error) {
throw new Meteor.Error('unable-to-get-file', 'Unable to get file', {
method: 'getFileFromWebdav',
});
}
},
});
View on GitHub (pinned to b2c16d5842)
Solutions
- Re-list the directory (getWebdavFileList) and confirm file.filename still exists, then retry with the fresh value
- Re-authenticate the WebDAV account (remove and re-add it) if stored credentials or the OAuth token may have expired
- Check the WebDAV server's logs for the rejected request (404 vs 401 vs 502 tells you which case it is)
- For recurring transient failures, wrap the download in a single retry with backoff
Example fix
// before
await call('getFileFromWebdav', accountId, file); // → unable-to-get-file
// after — confirm the node still exists, then fetch
const list = await call('getWebdavFileList', accountId, dirname(file.filename));
if (!list.data.some((n) => n.filename === file.filename)) {
throw new Error('File no longer exists on the WebDAV server');
}
await call('getFileFromWebdav', accountId, file); Defensive patterns
Strategy: try-catch
Validate before calling
const list = await Meteor.callAsync('getWebdavFileList', accountId, dirname(file.filename));
if (!list.data.some((n) => n.filename === file.filename)) {
throw new Error('File no longer exists on the WebDAV server');
}
await Meteor.callAsync('getFileFromWebdav', accountId, file); Try / catch
try {
await Meteor.callAsync('getFileFromWebdav', accountId, file);
} catch (e) {
if (e.error === 'unable-to-get-file') {
// re-list the directory; if the file exists, re-auth the account;
// one bounded retry helps only for transient network drops
}
} Prevention
- Use filenames taken from a fresh getWebdavFileList result, not cached state
- Re-link WebDAV accounts when their credentials or tokens rotate
- Check the WebDAV server logs to distinguish 404/401/network cases
When it happens
Trigger: Requesting a file whose filename no longer exists or is not readable by the account's credentials; the stored OAuth token/password expired since the account was linked; connectivity or TLS failure between Rocket.Chat and the WebDAV server during the fetch.
Common situations: Files renamed or deleted on the WebDAV server after the file list was cached in the picker; token-based accounts whose access token expired; flaky links or proxies interrupting large downloads.
Related errors
- could-not-access-webdav
- error-invalid-user
- could-not-access-webdav
- Error sending file to apps
- App package download failed
AI-assisted analysis of RocketChat/Rocket.Chat@b2c16d5842 (2026-08-18).
Data as JSON: /api/errors/cc438f02e86cf0cd.
Report an issue: GitHub.