FlowiseAI/Flowise · error · Error

Failed to index some documents: ${JSON.stringify(response.Fa

Error message

Failed to index some documents: ${JSON.stringify(response.FailedDocuments)}

What it means

AWS Kendra's BatchPutDocumentCommand returned a non-empty FailedDocuments list. Each failed document has an Id, ErrorCode, and ErrorMessage; the error stringifies the whole list. Some documents in the batch were not indexed.

Source

Thrown at packages/components/nodes/vectorstores/Kendra/Kendra.ts:169

                }
            }

            try {
                if (kendraDocuments.length > 0) {
                    // Kendra has a limit of 10 documents per batch
                    const batchSize = 10
                    for (let i = 0; i < kendraDocuments.length; i += batchSize) {
                        const batch = kendraDocuments.slice(i, i + batchSize)
                        const command = new BatchPutDocumentCommand({
                            IndexId: indexId,
                            Documents: batch
                        })

                        const response = await client.send(command)

                        if (response.FailedDocuments && response.FailedDocuments.length > 0) {
                            console.error('Failed documents:', response.FailedDocuments)
                            throw new Error(`Failed to index some documents: ${JSON.stringify(response.FailedDocuments)}`)
                        }
                    }
                }

                return { numAdded: finalDocs.length, addedDocs: finalDocs }
            } catch (error) {
                throw new Error(`Failed to index documents to Kendra: ${error}`)
            }
        },

        async delete(nodeData: INodeData, ids: string[], options: ICommonObject): Promise<void> {
            const indexId = nodeData.inputs?.indexId as string
            const region = nodeData.inputs?.region as string

            const credentialConfig = await getAWSCredentialConfig(nodeData, options, region)
            let clientConfig: KendraClientConfig = { region }
            if (credentialConfig.credentials) {
                clientConfig.credentials = credentialConfig.credentials

View on GitHub (pinned to abe4a8601a)

Solutions

  1. Parse response.FailedDocuments to identify which Ids failed and their ErrorCodes; fix and retry only those.
  2. Ensure each Kendra document has required fields (Title, ContentType) and valid attributes.
  3. Confirm the index is ACTIVE and not being modified.
  4. Log FailedDocuments before throwing so partial failures are visible.

Example fix

// before
throw new Error(`Failed to index some documents: ${JSON.stringify(response.FailedDocuments)}`)

// after
console.error('Failed documents:', response.FailedDocuments)
const failedIds = response.FailedDocuments.map(d => d.Id)
throw new Error(`Failed to index ${failedIds.length} doc(s): ${failedIds.join(',')}`, { cause: response.FailedDocuments })
Defensive patterns

Strategy: try-catch

Validate before calling

function validateKendraDocs(docs: KendraDocument[]) {
  for (const d of docs) {
    if (!d.Title) throw new Error(`Document ${d.Id} missing Title`)
    if (!d.ContentType) throw new Error(`Document ${d.Id} missing ContentType`)
  }
}
validateKendraDocs(kendraDocuments)
// confirm index ACTIVE
const idx = await client.send(new DescribeIndexCommand({ Id: indexId }))
if (idx.Status !== 'ACTIVE') throw new Error(`Index ${indexId} is ${idx.Status}`)

Type guard

function hasFailedDocuments(r: unknown): r is { FailedDocuments: { Id: string; ErrorCode: string; ErrorMessage?: string }[] } {
  return typeof r === 'object' && r !== null && Array.isArray((r as any).FailedDocuments) && (r as any).FailedDocuments.length > 0
}

Try / catch

const response = await client.send(command)
if (hasFailedDocuments(response)) {
  const retryable = response.FailedDocuments.filter(d => /quota|throttl/i.test(d.ErrorCode))
  if (retryable.length) { await backoff(); /* retry those */ }
  else throw new Error(`Kendra rejected docs: ${response.FailedDocuments.map(d => d.Id).join(',')}`)
}

Prevention

When it happens

Trigger: Batch upsert (10 docs per batch) into a Kendra index. Fails when Kendra reports per-document failures such as DOCUMENT_MISSING_TITLE, BAD_FILTER, ACCESS_DENIED, or quota exceeded.

Common situations: Document missing required attributes (Title/ContentType), access control misconfigured, oversized documents, or Kendra index not in ACTIVE state.

Related errors


AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12). Data as JSON: /api/errors/2e77de0ad7c42e06. Report an issue: GitHub.