From 93783e5fd9712fa8d3210aa87373d3757a05a44c Mon Sep 17 00:00:00 2001 From: Oleg Levchenko Date: Thu, 26 Feb 2026 22:18:59 +0100 Subject: [PATCH] Handle Bedrock 'prompt is too long' error Extend Bedrock provider validation handling to treat messages containing "prompt is too long" as a context-length-exceeded error. The code now extracts the validation message into a local variable and checks both the existing "Input is too long for requested model." phrase and the new "prompt is too long" phrase, mapping either to ProviderError::ContextLengthExceeded. Signed-off-by: Oleg Levchenko Remove build.sh from tracking Signed-off-by: Oleg Levchenko --- crates/goose/src/providers/bedrock.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/crates/goose/src/providers/bedrock.rs b/crates/goose/src/providers/bedrock.rs index ff0fc41e40ba..845ca22b39c2 100644 --- a/crates/goose/src/providers/bedrock.rs +++ b/crates/goose/src/providers/bedrock.rs @@ -284,10 +284,11 @@ impl BedrockProvider { ProviderError::Authentication(format!("Failed to call Bedrock: {:?}", err)) } ConverseError::ValidationException(err) - if err - .message() - .unwrap_or_default() - .contains("Input is too long for requested model.") => + if { + let msg = err.message().unwrap_or_default(); + msg.contains("Input is too long for requested model.") + || msg.contains("prompt is too long") + } => { ProviderError::ContextLengthExceeded(format!( "Failed to call Bedrock: {:?}",