{"record":{"id":"72bd96c5af293d24","repo":"FlowiseAI/Flowise","slug":"aws-bedrock-retry-limit-reached","errorCode":null,"errorMessage":"AWS Bedrock retry limit reached: ","messagePattern":"AWS Bedrock retry limit reached: ","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/components/nodes/embeddings/AWSBedrockEmbedding/AWSBedrockEmbedding.ts","lineNumber":263,"sourceCode":"): Promise<number[][]> => {\n    let sleepTime = 0\n    let retryCounter = 0\n    let result: number[][] = []\n    for (let i = 0; i < documents.length; i += batchSize) {\n        let chunk = documents.slice(i, i + batchSize)\n        try {\n            let chunkResult = await Promise.all(chunk.map(processFunc))\n            result.push(...chunkResult)\n            retryCounter = 0\n        } catch (e) {\n            if (retryCounter < maxRetries && e.name.includes('ThrottlingException')) {\n                retryCounter = retryCounter + 1\n                i = i - batchSize\n                sleepTime = sleepTime + 100\n            } else {\n                // Split to distinguish between throttling retry error and other errors in trance\n                if (e.name.includes('ThrottlingException')) {\n                    throw new Error('AWS Bedrock retry limit reached: ' + e)\n                } else {\n                    throw new Error(e)\n                }\n            }\n        }\n        await new Promise((resolve) => setTimeout(resolve, sleepTime))\n    }\n    return result\n}\n\nmodule.exports = { nodeClass: AWSBedrockEmbedding_Embeddings }\n","sourceCodeStart":245,"sourceCodeEnd":275,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/nodes/embeddings/AWSBedrockEmbedding/AWSBedrockEmbedding.ts#L245-L275","documentation":"Thrown by processInBatches after the in-loop retry counter exhausts maxRetries while AWS Bedrock keeps raising ThrottlingException. Each retry re-runs the same batchSize chunk (i = i - batchSize) and adds 100ms of backoff (sleepTime += 100). Non-throttling errors bypass retries entirely and throw at the else branch.","triggerScenarios":"Embedding a large document set through AWSBedrockEmbedding where concurrent InvokeModel calls per batch exceed the model/region TPS quota for more than maxRetries consecutive attempts. Sustained 429 ThrottlingException from the Bedrock runtime on amazon.titan-embed-text-v2 / cohere.embed payloads.","commonSituations":"batchSize set too high for the account quota; burst traffic in a shared AWS account; quota increase never requested for the region/model; high concurrency from multiple chatflows hitting the same credentials.","solutions":["Lower the node's batchSize (e.g. from 50 to 10) so each chunk stays under the model TPS limit.","Request a Bedrock model quota increase in the AWS console for the target region/model.","Increase maxRetries and/or pre-throttle the call rate from the caller so retries have room to succeed.","Reduce concurrency by processing documents sequentially instead of Promise.all over the chunk."],"exampleFix":"// before\nconst emb = await processInBatches(texts, 50, 3, embedOne)\n// after\nconst emb = await processInBatches(texts, 10, 6, embedOne)","handlingStrategy":"retry","validationCode":"// Estimate per-batch request count vs model TPS quota before embedding\nconst TPS_LIMIT = Number(process.env.BEDROCK_TPS_LIMIT ?? 5)\nfunction safeBatchSize(desired: number, concurrency: number): number {\n  return Math.max(1, Math.min(desired, Math.floor(TPS_LIMIT / Math.max(1, concurrency))))\n}\nconst batchSize = safeBatchSize(50, 1)","typeGuard":null,"tryCatchPattern":"// Wrap the embedding call; on retry-limit-exhausted, shrink batch and retry once\ntry {\n  await processInBatches(texts, batchSize, maxRetries, embed)\n} catch (e) {\n  if (e instanceof Error && /retry limit reached/i.test(e.message)) {\n    await processInBatches(texts, Math.max(1, Math.floor(batchSize / 2)), maxRetries, embed)\n  } else {\n    throw e\n  }\n}","preventionTips":["Right-size batchSize against the Bedrock model's documented TPS quota.","Request a quota increase before bulk-embedding large corpora.","Run a small probe batch first to measure throttle headroom.","Keep the outer caller idempotent so caller-level retry is safe."],"tags":["aws","bedrock","embeddings","throttling","retry","rate-limit"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}