janhq/jan · error · Error
Failed to resolve ingested attachment id
Error message
Failed to resolve ingested attachment id
What it means
Thrown by ingestFileAttachment when ingestAttachments resolved but the returned files array is empty or the first entry has no id. The backend accepted the call but produced no usable file reference - typically the document was silently rejected during indexing.
Source
Thrown at web-app/src/services/uploads/default.ts:30
return { id: ulid() }
}
async ingestFileAttachment(threadId: string, attachment: Attachment): Promise<UploadResult> {
if (attachment.type !== 'document') throw new Error('ingestFileAttachment: attachment is not document')
const ext = ExtensionManager.getInstance().get<RAGExtension>(ExtensionTypeEnum.RAG)
if (!ext?.ingestAttachments) throw new Error('RAG extension not available')
const res: IngestAttachmentsResult = await ext.ingestAttachments(threadId, [
{ path: attachment.path!, name: attachment.name, type: attachment.fileType, size: attachment.size },
])
const files = res.files
if (Array.isArray(files) && files[0]?.id) {
return {
id: files[0].id,
size: typeof files[0].size === 'number' ? Number(files[0].size) : undefined,
chunkCount: typeof files[0].chunk_count === 'number' ? Number(files[0].chunk_count) : undefined,
}
}
throw new Error('Failed to resolve ingested attachment id')
}
async ingestFileAttachmentForProject(projectId: string, attachment: Attachment): Promise<UploadResult> {
if (attachment.type !== 'document') throw new Error('ingestFileAttachmentForProject: attachment is not document')
const ext = ExtensionManager.getInstance().get<RAGExtension>(ExtensionTypeEnum.RAG)
if (!ext?.ingestAttachmentsForProject) throw new Error('RAG extension does not support project-level ingestion')
const res: IngestAttachmentsResult = await ext.ingestAttachmentsForProject(projectId, [
{ path: attachment.path!, name: attachment.name, type: attachment.fileType, size: attachment.size },
])
const files = res.files
if (Array.isArray(files) && files[0]?.id) {
return {
id: files[0].id,
size: typeof files[0].size === 'number' ? Number(files[0].size) : undefined,
chunkCount: typeof files[0].chunk_count === 'number' ? Number(files[0].chunk_count) : undefined,
}
}
throw new Error('Failed to resolve ingested attachment id')View on GitHub (pinned to fad3f12a14)
Solutions
- Check the RAG backend logs for why the file produced no chunks/id.
- Verify the file type is supported and the file is non-empty.
- Retry; if persistent, report with the file name and type.
Example fix
// before: generic 'Failed to resolve ingested attachment id'
if (!Array.isArray(files) || !files[0]?.id) throw new Error('Failed to resolve ingested attachment id')
// after: name the file and hint at the likely cause
if (!Array.isArray(files) || !files[0]?.id) {
throw new Error(`Ingestion of '${attachment.name}' produced no id; the backend may not support this file type`)
} Defensive patterns
Strategy: try-catch
Validate before calling
function validateIngestResult(res: IngestAttachmentsResult): boolean {
return Array.isArray(res.files) && !!res.files[0]?.id
} Type guard
function hasIngestedId(res: unknown): res is { files: { id: string }[] } {
return Array.isArray((res as any)?.files) && !!((res as any).files[0]?.id)
} Try / catch
try {
await uploads.ingestFileAttachment(tid, att)
} catch (e) {
if (/resolve ingested attachment id/.test(String((e as Error).message))) {
showFileFailed(att.name)
} else throw e
} Prevention
- Validate supported file types before uploading.
- Surface per-file failure to the user with the filename.
When it happens
Trigger: res.files is not an array, is empty, or res.files[0].id is falsy after a successful (non-throwing) ingestAttachments call.
Common situations: Unsupported file format silently rejected by the indexer; backend bug returning an empty result; partial backend failure; file too large or deduplicated to nothing; malformed backend response.
Related errors
- RAG extension not available
- RAG extension does not support project-level ingestion
- No supported backend binaries found for this system. Backend
- Failed to fetch supported backends: ${error instanceof Error
- Invalid backend string: ${targetBackendString} supplied to u
AI-assisted analysis of janhq/jan@fad3f12a14 (2026-08-12).
Data as JSON: /api/errors/91c2e99895f805ef.
Report an issue: GitHub.