{"record":{"id":"5e18be7a3ad096ca","repo":"janhq/jan","slug":"file-f-name-exceeds-size-limit-f-size-byt","errorCode":null,"errorMessage":"File '${f.name}' exceeds size limit (${f.size} bytes > ${maxSize} MB).","messagePattern":"File '(.+?)' exceeds size limit \\((.+?) bytes > (.+?) MB\\)\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"extensions/rag-extension/src/index.ts","lineNumber":402,"sourceCode":"      ExtensionTypeEnum.VectorDB\n    ) as unknown as VectorDBExtension\n    if (!vec?.ingestFileForProject) {\n      throw new Error('Vector DB extension does not support project-level ingestion')\n    }\n\n    // Load settings\n    const s = this.config\n    const maxSize = (s?.enabled === false ? 0 : s?.maxFileSizeMB) || undefined\n    const chunkSize = s?.chunkSizeChars as number | undefined\n    const chunkOverlap = s?.overlapChars as number | undefined\n\n    let totalChunks = 0\n    const processedFiles: AttachmentFileInfo[] = []\n\n    for (const f of files) {\n      if (!f?.path) continue\n      if (maxSize && f.size && f.size > maxSize * 1024 * 1024) {\n        throw new Error(\n          `File '${f.name}' exceeds size limit (${f.size} bytes > ${maxSize} MB).`\n        )\n      }\n\n      const fileName = f.name || f.path.split(/[\\\\/]/).pop()\n      const info = await (vec as VectorDBExtension).ingestFileForProject(\n        projectId,\n        { path: f.path, name: fileName, type: f.type, size: f.size },\n        { chunkSize: chunkSize ?? 512, chunkOverlap: chunkOverlap ?? 64 }\n      )\n      totalChunks += Number(info?.chunk_count || 0)\n      processedFiles.push(info)\n    }\n\n    return {\n      filesProcessed: processedFiles.length,\n      chunksInserted: totalChunks,\n      files: processedFiles,","sourceCodeStart":384,"sourceCodeEnd":420,"githubUrl":"https://github.com/janhq/jan/blob/7205d770c1e097c3daf35a911176410e93bc5564/extensions/rag-extension/src/index.ts#L384-L420","documentation":"The RAG extension throws this when an attachment file being ingested via ingestAttachmentsForProject is larger than the configured per-file size limit (maxFileSizeMB, in MB). The check converts maxSize from MB to bytes and compares against f.size. It is a guard against ingesting oversized documents into the vector DB.","triggerScenarios":"Calling ingestAttachmentsForProject with a file whose f.size exceeds maxSize*1024*1024 bytes while maxSize (from extension settings maxFileSizeMB) is set and non-zero.","commonSituations":"Users attach large PDFs/videos to a project; default or configured maxFileSizeMB is small (e.g. 5-10MB); a settings update lowered the limit while old large files remain.","solutions":["Increase maxFileSizeMB in the RAG extension settings to cover the file being attached","Compress or split the oversized file before ingestion","Set maxSize to 0 / disable the size limit in settings if large files are acceptable","Skip or surface the offending file in the UI before calling ingestAttachmentsForProject"],"exampleFix":"// before\nawait rag.ingestAttachmentsForProject(projectId, files) // throws for big files\n// after\nconst limitMb = (rag.settings?.maxFileSizeMB ?? 10)\nconst allowed = files.filter(f => !f.size || f.size <= limitMb * 1024 * 1024)\nawait rag.ingestAttachmentsForProject(projectId, allowed)","handlingStrategy":"validation","validationCode":"const maxSizeMb = 10 // or from settings\nconst tooBig = files.filter(f => f.size && f.size > maxSizeMb * 1024 * 1024)\nif (tooBig.length) {\n  throw new Error(`Files exceed ${maxSizeMb}MB limit: ${tooBig.map(f => f.name).join(', ')}`)\n}","typeGuard":"const isWithinSizeLimit = (f, maxMb) => Boolean(f?.path) && (!f.size || f.size <= maxMb * 1024 * 1024)","tryCatchPattern":null,"preventionTips":["Validate file sizes in the UI before calling ingestion APIs","Keep maxFileSizeMB in settings consistent with what users typically attach","Surface a clear size-limit message listing rejected files"],"tags":["file-size","validation","rag"],"backgroundTag":"file-size-limit-exceeded","analyzedSha":"7205d770c1e097c3daf35a911176410e93bc5564","analyzedAt":"2026-09-17T14:27:30.100Z","contentChangedAt":"2026-09-17T14:27:30.100Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}