danny-avila/LibreChat · error
An error occurred during file upload.
Error message
An error occurred during file upload.
What it means
Thrown by uploadVectors in its catch block as a last-resort wrapper for any error that occurs during the vector upload process. This catches errors from the axios POST to the RAG API, the response parsing, or the known_type/status checks (errors 116 and 117 are re-thrown and caught here). The thrown error uses the original error.message if available, or falls back to a generic message. logAxiosError is called first for detailed logging.
Source
Thrown at api/server/services/Files/VectorDB/crud.js:118
throw new Error(`File embedding failed. The filetype ${file.mimetype} is not supported`);
}
if (!responseData.status) {
throw new Error('File embedding failed.');
}
return {
bytes: file.size,
filename: file.originalname,
filepath: FileSources.vectordb,
embedded: Boolean(responseData.known_type),
};
} catch (error) {
logAxiosError({
error,
message: 'Error uploading vectors',
});
throw new Error(error.message || 'An error occurred during file upload.');
}
}
module.exports = {
deleteVectors,
uploadVectors,
};
View on GitHub (pinned to 5ff282f900)
Solutions
- Check server logs — logAxiosError logs the detailed axios error before this generic throw.
- Verify RAG_API_URL is reachable from the app server (curl or health check).
- If the underlying error is error 116 or 117, address those specific conditions.
- For network errors, check firewall rules, DNS resolution, and RAG API container health.
- Consider preserving the original error type rather than wrapping, so callers can distinguish unsupported-type errors from network failures.
Example fix
// Note: the current catch block wraps ALL errors, losing the specific
// known_type/status messages. Consider rethrowing those:
// before
} catch (error) {
logAxiosError({ error, message: 'Error uploading vectors' });
throw new Error(error.message || 'An error occurred during file upload.');
}
// after — preserve specific errors
} catch (error) {
logAxiosError({ error, message: 'Error uploading vectors' });
if (error.message.startsWith('File embedding failed')) {
throw error; // preserve specific message
}
throw new Error(error.message || 'An error occurred during file upload.');
} Defensive patterns
Strategy: try-catch
Try / catch
try {
const result = await uploadVectors({ req, file, file_id });
} catch (error) {
// Distinguish known_type/status errors from network errors
if (error.message.includes('not supported')) {
return res.status(415).json({ error: error.message });
}
if (error.message.includes('embedding failed')) {
return res.status(502).json({ error: 'Embedding service error' });
}
// Generic network/unknown error
return res.status(500).json({ error: 'Vector upload failed' });
} Prevention
- Check server logs for the detailed axios error logged by logAxiosError before this generic throw.
- Verify RAG_API_URL connectivity and health before relying on vector uploads.
- Consider preserving the original error type rather than wrapping, so callers can branch on cause.
- Implement circuit breaker or retry logic for transient RAG API failures.
When it happens
Trigger: Any unhandled exception during uploadVectors: network failure reaching the RAG API (ECONNREFUSED, ETIMEDOUT), HTTP error status from the RAG API (4xx/5xx that throws from axios), or the known_type/status errors thrown inside the try block being re-caught here.
Common situations: The RAG API is unreachable (network error, DNS failure). Or the RAG API returns a 4xx/5xx HTTP error. Or an unsupported file type (error 116) or embedding failure (error 117) is thrown inside the try block and re-caught here, losing the original specific message because it wraps with error.message.
Related errors
- An error occurred during file deletion.
- File embedding failed.
- RAG_API_URL not defined
- File embedding failed. The filetype ${file.mimetype} is not
- Remote file response too large: ${buffer.length} bytes
AI-assisted analysis of danny-avila/LibreChat@5ff282f900 (2026-08-12).
Data as JSON: /api/errors/6e18abca43fa4f9e.
Report an issue: GitHub.