chatboxai/chatbox · error · Error
Attachment did not produce any retrievable chunks
Error message
Attachment did not produce any retrievable chunks
What it means
Thrown after buildAttachmentChunks runs when either parents or children arrays are empty. Chunking produced no retrievable units, so embedding would be meaningless. The check is parents.length === 0 || children.length === 0.
Source
Thrown at src/main/session-attachment-rag/file-loaders.ts:112
const attachment = await ensureAttachmentNotCanceled(attachmentId)
log.debug(
`${SESSION_ATTACHMENT_RAG_LOG_PREFIX} [FILE] Begin processing attachment: id=${attachment.id}, file="${attachment.filename}", parser=${attachment.parserType ?? 'unknown'}, storageKey=${attachment.attachmentStorageKey}`
)
const content = await getStoreBlob(attachment.attachmentStorageKey)
if (!content?.trim()) {
throw new Error('Attachment content not found or empty')
}
const chunkingPipeline = selectAttachmentChunkingPipeline(attachment.filename)
await updateSessionAttachmentIndexingProgress(attachmentId, {
indexingStage: 'chunking',
totalChunks: 0,
embeddedChunks: 0,
})
const { parents, children } = await buildAttachmentChunks(content, attachment.filename)
if (parents.length === 0 || children.length === 0) {
throw new Error('Attachment did not produce any retrievable chunks')
}
await ensureAttachmentNotCanceled(attachmentId)
log.debug(
`${SESSION_ATTACHMENT_RAG_LOG_PREFIX} [FILE] Chunking completed: attachmentId=${attachment.id}, pipeline=${chunkingPipeline}, parents=${parents.length}, children=${children.length}`
)
const parentIdMap = await replaceAttachmentParentsAndChunks(
attachment.id,
parents.map((parent) => ({
parentOrder: parent.parentOrder,
sectionPath: parent.sectionPath,
docType: attachment.mimeType,
text: parent.text,
tokenEstimate: parent.tokenEstimate,
charCount: parent.charCount,
})),
children.map((child) => ({
parentOrder: child.parentOrder,View on GitHub (pinned to 81571269ad)
Solutions
- Inspect selectAttachmentChunkingPipeline(filename) and the parser output for the offending file to see why extraction yielded nothing.
- For scanned PDFs, run OCR first or reject them at upload with a clear message.
- Lower the minimum-chunk-size threshold or split overly-large min sizes so small valid content still produces one chunk.
- If a parser returns no text, mark the attachment failed with 'could not extract text' instead of the generic chunking error.
Example fix
// before
if (parents.length === 0 || children.length === 0) throw new Error('Attachment did not produce any retrievable chunks')
// after: report which side failed and the parser used
if (parents.length === 0 || children.length === 0) {
throw new Error(`Attachment produced no retrievable chunks (parents=${parents.length}, children=${children.length}, pipeline=${chunkingPipeline})`)
} Defensive patterns
Strategy: validation
Validate before calling
if (!content.trim()) { /* handled by [89] */ }
const sample = content.slice(0, 1000)
if (!sample.replace(/\s/g, '')) { await markSessionAttachmentFailed(id, 'no extractable text'); return } Type guard
function isNoChunks(e: unknown): e is Error { return e instanceof Error && e.message === 'Attachment did not produce any retrievable chunks' } Try / catch
// the outer processing loop marks the attachment failed; enrich the message with pipeline/parser info before surfacing.
Prevention
- OCR scanned PDFs before indexing.
- Reject image-only files with text mime types at upload.
- Tune minimum-chunk-size so small but valid content still yields one chunk.
When it happens
Trigger: A file whose content (after selectAttachmentChunkingPipeline) yields zero chunks: e.g. a binary/non-text file misclassified as text, a PDF whose text extraction returned nothing, a markdown file containing only frontmatter with no body, or a chunking config whose min-size threshold exceeds the entire content.
Common situations: Scanned PDF with no OCR text layer; image-only file with a text mime type; chunking min chunk size larger than document; parser returned content that the chunker strips entirely (e.g. only whitespace after normalization).
Related errors
- Session attachment ${id} not found
- Only failed session attachments can be retried
- Attachment content not found or empty
- Invalid rerank model format: ${modelString}
- Failed to mark attachment ${attachment.id} ready
AI-assisted analysis of chatboxai/chatbox@81571269ad (2026-08-12).
Data as JSON: /api/errors/b01958feaf6effb4.
Report an issue: GitHub.