zed-industries/zed · error

{}

Error message

{}

What it means

The Bedrock provider streams via invoke_with_response_stream and surfaces any error received on the event stream by formatting it with the AWS SDK's DisplayErrorContext, which renders the full error chain (service exception, message, request id). The text after this wrapper varies with the underlying AWS error.

Source

Thrown at crates/bedrock/src/bedrock.rs:128

                    ConverseStreamError::InternalServerException(e) => {
                        BedrockError::InternalServer(
                            e.message().unwrap_or("internal server error").to_string(),
                        )
                    }
                    _ => BedrockError::Other(err.into()),
                }
            }
            other => BedrockError::Other(other.into()),
        });

    let stream = Box::pin(stream::unfold(
        output?.stream,
        move |mut stream| async move {
            match stream.recv().await {
                Ok(Some(output)) => Some((Ok(output), stream)),
                Ok(None) => None,
                Err(err) => Some((
                    Err(anyhow!(
                        "{}",
                        aws_sdk_bedrockruntime::error::DisplayErrorContext(err)
                    )),
                    stream,
                )),
            }
        },
    ));

    Ok(stream)
}

pub fn aws_document_to_value(document: &Document) -> Value {
    match document {
        Document::Null => Value::Null,
        Document::Bool(value) => Value::Bool(*value),
        Document::Number(value) => match *value {
            AwsNumber::PosInt(value) => Value::Number(Number::from(value)),

View on GitHub (pinned to bc538def45)

Solutions

  1. Read the inner AWS error in the message and act on it: AccessDeniedException - request model access in the Bedrock console for that region; ThrottlingException - retry with backoff or raise limits.
  2. Verify setup: `aws bedrock list-foundation-models --region <region>` and `aws sts get-caller-identity`.
  3. Retry transient errors (throttling, 500s) with exponential backoff.
  4. Match the model to a region where it is available, or use a cross-region inference profile.
Defensive patterns

Strategy: retry

Validate before calling

// pre-flight: credentials, region, and model access
let models = bedrock
    .list_foundation_models()
    .region(region.clone())
    .send()
    .await?;
anyhow::ensure!(
    models.summaries().iter().any(|m| m.model_id() == Some(model_id)),
    "model not available in {region}"
);

Try / catch

match the DisplayErrorContext text: ThrottlingException/ServiceUnavailable -> exponential backoff and re-issue the request; AccessDeniedException/ExpiredToken -> stop and re-authenticate (do not retry); ValidationException -> fix the request before retrying.

Prevention

When it happens

Trigger: stream.recv() returns Err mid-generation inside the stream::unfold loop: ThrottlingException (throughput exceeded), AccessDeniedException (model access not enabled in the account/region), ExpiredToken/credential errors, ValidationException (context too long), or server-side 500s.

Common situations: Claude model access not granted in the target Bedrock region; assumed-role credentials expiring during long generations; bursting past provisioned throughput; using a region where the model is unavailable.

Related errors


AI-assisted analysis of zed-industries/zed@bc538def45 (2026-08-16). Data as JSON: /api/errors/780b1c0b96b5917c. Report an issue: GitHub.