FlowiseAI/Flowise · error · Error

Failed to delete documents from Kendra: ${error}

Error message

Failed to delete documents from Kendra: ${error}

What it means

Catch-all around the Kendra batch delete loop (BatchDeleteDocumentCommand, 10 ids per batch). Wraps any KendraClient.send failure into a string Error.

Source

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

            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) {
                    const batch = ids.slice(i, i + batchSize)
                    const command = new BatchDeleteDocumentCommand({
                        IndexId: indexId,
                        DocumentIdList: batch
                    })
                    await client.send(command)
                }
            } catch (error) {
                throw new Error(`Failed to delete documents from Kendra: ${error}`)
            }
        }
    }

    async init(nodeData: INodeData, _: string, options: ICommonObject): Promise<any> {
        const indexId = nodeData.inputs?.indexId as string
        const region = nodeData.inputs?.region as string
        const topK = nodeData.inputs?.topK as string
        const attributeFilter = nodeData.inputs?.attributeFilter
        const isFileUploadEnabled = nodeData.inputs?.fileUpload as boolean

        const credentialConfig = await getAWSCredentialConfig(nodeData, options, region)
        let clientOptions: Partial<KendraClientConfig> = {}

        if (credentialConfig.credentials) {
            clientOptions.credentials = credentialConfig.credentials
        }

View on GitHub (pinned to abe4a8601a)

Solutions

  1. Confirm the IAM principal has kendra:BatchDeleteDocument on the index.
  2. Verify indexId and region match the index used for upsert.
  3. Retry transient AWS errors with exponential backoff.
  4. Rethrow the original error to retain the AWS SDK's retryable flag.

Example fix

// before
} catch (error) {
    throw new Error(`Failed to delete documents from Kendra: ${error}`)
}

// after
} catch (error) {
    console.error('Kendra delete failed', error)
    throw error
}
Defensive patterns

Strategy: retry

Validate before calling

const idx = await client.send(new DescribeIndexCommand({ Id: indexId }))
if (idx.Status !== 'ACTIVE') throw new Error(`Index ${indexId} not ACTIVE (${idx.Status})`)
if (!ids.length) return // nothing to delete

Type guard

function isRetryableAwsError(e: unknown): boolean {
  return typeof e === 'object' && e !== null
    && ['ThrottlingException', 'ServiceUnavailableException', 'RequestLimitExceeded'].includes((e as any).name)
}

Try / catch

for (let attempt = 0; attempt < 3; attempt++) {
  try { await deleteBatch(client, indexId, ids); break }
  catch (e) {
    if (isRetryableAwsError(e) && attempt < 2) { await backoff(attempt); continue }
    throw e
  }
}

Prevention

When it happens

Trigger: Delete ids from a Kendra index. Fails on auth/permission errors, wrong indexId, throttling, or Kendra service errors during batch delete.

Common situations: Missing kendra:BatchDeleteDocument permission, index in wrong region, indexId typo, or transient AWS service error.

Related errors


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