FlowiseAI/Flowise · error · Error
Failed to index documents to Kendra: ${error}
Error message
Failed to index documents to Kendra: ${error} What it means
Outer catch-all in the Kendra upsert path that wraps the inner 'Failed to index some documents' error (and any other error in batching/sending) into 'Failed to index documents to Kendra'. This double-wrapping obscures the original FailedDocuments detail.
Source
Thrown at packages/components/nodes/vectorstores/Kendra/Kendra.ts:176
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
}
const client = new KendraClient(clientConfig)
try {
// Kendra has a limit of 10 documents per batch delete
const batchSize = 10
for (let i = 0; i < ids.length; i += batchSize) {View on GitHub (pinned to abe4a8601a)
Solutions
- Inspect the wrapped message to see the inner cause (often the FailedDocuments JSON).
- Verify AWS credentials, region, and indexId are correct and the client has kendra:BatchPutDocument permission.
- Distinguish transport errors from partial failures: rethrow the original error to keep type information.
Example fix
// before
} catch (error) {
throw new Error(`Failed to index documents to Kendra: ${error}`)
}
// after
} catch (error) {
console.error('Kendra index failed', error)
throw error
} Defensive patterns
Strategy: try-catch
Validate before calling
const sts = await client.send(new GetCallerIdentityCommand({}))
// confirm permission
await client.send(new DescribeIndexCommand({ Id: indexId }))
// confirms kendra:DescribeIndex and that indexId exists in this region Type guard
function isKendraError(e: unknown): e is { name: string; $metadata: { httpStatusCode: number } } {
return typeof e === 'object' && e !== null && typeof (e as any).name === 'string' && /^.+Error$/.test((e as any).name)
} Try / catch
try {
await indexToKendra(client, indexId, kendraDocuments)
} catch (e) {
// unwrap the inner FailedDocuments detail if present
const inner = String(e).includes('FailedDocuments') ? String(e) : `Kendra index failed: ${e}`
throw new Error(inner, { cause: e })
} Prevention
- Grant kendra:BatchPutDocument and kendra:DescribeIndex to the IAM principal.
- Confirm region and indexId match the indexed index.
- Unwrap inner errors instead of double-wrapping them.
When it happens
Trigger: Any throw inside the try — the inner FailedDocuments throw, a KendraClient.send transport error, or a credential error — surfaces here as a wrapped string.
Common situations: AWS credentials invalid/missing, region wrong, index ARN/Id wrong, throttling, or the inner partial-failure throw propagating.
Related errors
- Failed to index some documents: ${JSON.stringify(response.Fa
- Failed to delete documents from Kendra: ${error}
- Failed to decrypt credential data.
- Error in Agent node: ${error instanceof Error ? error.messag
- Error in Condition Agent node: ${error instanceof Error ? er
AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12).
Data as JSON: /api/errors/85aa79e4d7f43b67.
Report an issue: GitHub.