{"record":{"id":"e758047217b42e5e","repo":"danny-avila/LibreChat","slug":"file-embedding-failed","errorCode":null,"errorMessage":"File embedding failed.","messagePattern":"File embedding failed\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"api/server/services/Files/VectorDB/crud.js","lineNumber":104,"sourceCode":"    const formHeaders = formData.getHeaders();\n\n    const response = await axios.post(`${process.env.RAG_API_URL}/embed`, formData, {\n      headers: {\n        Authorization: `Bearer ${jwtToken}`,\n        accept: 'application/json',\n        ...formHeaders,\n      },\n    });\n\n    const responseData = response.data;\n    logger.debug('Response from embedding file', responseData);\n\n    if (responseData.known_type === false) {\n      throw new Error(`File embedding failed. The filetype ${file.mimetype} is not supported`);\n    }\n\n    if (!responseData.status) {\n      throw new Error('File embedding failed.');\n    }\n\n    return {\n      bytes: file.size,\n      filename: file.originalname,\n      filepath: FileSources.vectordb,\n      embedded: Boolean(responseData.known_type),\n    };\n  } catch (error) {\n    logAxiosError({\n      error,\n      message: 'Error uploading vectors',\n    });\n    throw new Error(error.message || 'An error occurred during file upload.');\n  }\n}\n\nmodule.exports = {","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/danny-avila/LibreChat/blob/5ff282f9006c436e561de1afd39a481bea1ef0d8/api/server/services/Files/VectorDB/crud.js#L86-L122","documentation":"Thrown by uploadVectors when the RAG API's /embed endpoint responds with HTTP 200 but the response body contains status: false. This indicates the RAG API received the file and recognized its type (known_type was not false), but the embedding process itself failed — the server could not generate or store the vector embeddings. This is a server-side processing failure, distinct from an unsupported file type.","triggerScenarios":"Calling uploadVectors({ req, file, file_id }) where the RAG API returns { status: false, known_type: true }. The RAG API's embedding pipeline encountered an error: database write failure, embedding model unavailable, document parsing error, or resource exhaustion.","commonSituations":"The RAG API's embedding model (e.g., an OpenAI embeddings endpoint or local model) is unavailable or rate-limited. Or the RAG API's vector database is down or full. Or the file content triggered a parsing error (e.g., a corrupted PDF). Or the RAG API has a transient internal error.","solutions":["Check the RAG API service logs for the specific embedding failure that occurred.","Verify the RAG API's embedding model and vector database are operational.","Retry the upload after a brief delay — transient RAG API failures often resolve.","If the failure is persistent, test with a known-good file (e.g., a small plaintext .txt) to isolate whether the issue is file-specific or systemic."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await uploadVectors({ req, file, file_id });\n} catch (error) {\n  if (error.message === 'File embedding failed.') {\n    // RAG API processing failure — retry with backoff\n    await retryWithBackoff(() => uploadVectors({ req, file, file_id }), { retries: 3 });\n  }\n  throw error;\n}","preventionTips":["Monitor RAG API embedding model availability and vector database health.","Implement retry logic for transient embedding failures.","Test with a known-good file to distinguish file-specific issues from systemic failures.","Log RAG API responses for debugging embedding pipeline issues."],"tags":["vectordb","rag","file-upload","external-service","embedding"],"backgroundTag":null,"analyzedSha":"5ff282f9006c436e561de1afd39a481bea1ef0d8","analyzedAt":"2026-08-12T21:38:08.145Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}