{"record":{"id":"783a4a1d55645287","repo":"janhq/jan","slug":"rag-extension-not-available","errorCode":null,"errorMessage":"RAG extension not available","messagePattern":"RAG extension not available","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"web-app/src/services/uploads/default.ts","lineNumber":18,"sourceCode":"import type { UploadsService, UploadResult } from './types'\nimport type { Attachment } from '@/types/attachment'\nimport { ulid } from 'ulidx'\nimport { ExtensionManager } from '@/lib/extension'\nimport { ExtensionTypeEnum, type RAGExtension, type IngestAttachmentsResult } from '@janhq/core'\n\nexport class DefaultUploadsService implements UploadsService {\n  async ingestImage(_threadId: string, attachment: Attachment): Promise<UploadResult> {\n    if (attachment.type !== 'image') throw new Error('ingestImage: attachment is not image')\n    // Placeholder upload flow; swap for real API call when backend is ready\n    await new Promise((r) => setTimeout(r, 100))\n    return { id: ulid() }\n  }\n\n  async ingestFileAttachment(threadId: string, attachment: Attachment): Promise<UploadResult> {\n    if (attachment.type !== 'document') throw new Error('ingestFileAttachment: attachment is not document')\n    const ext = ExtensionManager.getInstance().get<RAGExtension>(ExtensionTypeEnum.RAG)\n    if (!ext?.ingestAttachments) throw new Error('RAG extension not available')\n    const res: IngestAttachmentsResult = await ext.ingestAttachments(threadId, [\n      { path: attachment.path!, name: attachment.name, type: attachment.fileType, size: attachment.size },\n    ])\n    const files = res.files\n    if (Array.isArray(files) && files[0]?.id) {\n      return {\n        id: files[0].id,\n        size: typeof files[0].size === 'number' ? Number(files[0].size) : undefined,\n        chunkCount: typeof files[0].chunk_count === 'number' ? Number(files[0].chunk_count) : undefined,\n      }\n    }\n    throw new Error('Failed to resolve ingested attachment id')\n  }\n\n  async ingestFileAttachmentForProject(projectId: string, attachment: Attachment): Promise<UploadResult> {\n    if (attachment.type !== 'document') throw new Error('ingestFileAttachmentForProject: attachment is not document')\n    const ext = ExtensionManager.getInstance().get<RAGExtension>(ExtensionTypeEnum.RAG)\n    if (!ext?.ingestAttachmentsForProject) throw new Error('RAG extension does not support project-level ingestion')","sourceCodeStart":1,"sourceCodeEnd":36,"githubUrl":"https://github.com/janhq/jan/blob/fad3f12a147d138388a66f0d92a02b2675f65294/web-app/src/services/uploads/default.ts#L1-L36","documentation":"Thrown by ingestFileAttachment when the RAG extension is not registered or does not expose ingestAttachments. Document ingestion depends on the RAG extension; without that capability the operation cannot proceed.","triggerScenarios":"ExtensionManager.get<RAGExtension>(ExtensionTypeEnum.RAG) returns undefined, OR the returned object has no ingestAttachments function - so !ext?.ingestAttachments is true.","commonSituations":"RAG extension disabled or not installed; startup race where RAG is not registered yet; extension built without the ingestion capability.","solutions":["Ensure the RAG extension is enabled and loaded before offering document uploads.","Retry once shortly after startup in case of a registration race.","If unavailable, disable the document-upload UI affordance."],"exampleFix":"// before: throw when RAG missing\nconst ext = ExtensionManager.getInstance().get<RAGExtension>(ExtensionTypeEnum.RAG)\nif (!ext?.ingestAttachments) throw new Error('RAG extension not available')\n// after: gate the UI on capability\nconst ext = ExtensionManager.getInstance().get<RAGExtension>(ExtensionTypeEnum.RAG)\nif (!ext?.ingestAttachments) { setDocUploadEnabled(false); return }","handlingStrategy":"validation","validationCode":"function isRagAvailable(): boolean {\n  return !!ExtensionManager.getInstance().get<RAGExtension>(ExtensionTypeEnum.RAG)?.ingestAttachments\n}","typeGuard":"function hasIngestAttachments(e: unknown): e is RAGExtension {\n  return !!e && typeof (e as RAGExtension).ingestAttachments === 'function'\n}","tryCatchPattern":null,"preventionTips":["Gate the document-upload UI on RAG extension presence.","Expose an 'extensions ready' signal so callers can retry during startup."],"tags":["extension","rag","uploads","capability","startup"],"backgroundTag":null,"analyzedSha":"fad3f12a147d138388a66f0d92a02b2675f65294","analyzedAt":"2026-08-12T20:33:47.516Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}