windmill-labs/windmill · error

Service error: {} (details: {:?})

Error message

Service error: {} (details: {:?})

What it means

When the AWS Bedrock Runtime SDK returns a service-side error, Windmill formats it via format_bedrock_error into "Service error: {} (details: {:?})" before surfacing it as an AI job error. The message carries the SdkError's inner error and full debug dump (request id, metadata).

Source

Thrown at backend/windmill-ai/src/ai_bedrock.rs:308

        &self.client
    }
}

// ============================================================================
// Error Formatting
// ============================================================================

/// Format AWS SDK errors with detailed information
pub fn format_bedrock_error<E, R>(error: &aws_sdk_bedrockruntime::error::SdkError<E, R>) -> String
where
    E: std::fmt::Debug + std::fmt::Display,
    R: std::fmt::Debug,
{
    use aws_sdk_bedrockruntime::error::SdkError;

    match error {
        SdkError::ServiceError(err) => {
            format!("Service error: {} (details: {:?})", err.err(), err)
        }
        SdkError::ConstructionFailure(err) => {
            format!("Request construction failed: {:?}", err)
        }
        SdkError::DispatchFailure(err) => {
            format!("Request dispatch failed: {:?}", err)
        }
        SdkError::ResponseError(err) => {
            format!("Response error: {:?}", err)
        }
        SdkError::TimeoutError(err) => {
            format!("Request timeout: {:?}", err)
        }
        _ => format!("{:?}", error),
    }
}

// ============================================================================

View on GitHub (pinned to e474e8803c)

Solutions

  1. Read err.err() in the message to see the AWS error type and fix accordingly (model ID, permissions, payload size)
  2. Verify IAM permissions for bedrock:InvokeModelWithResponseStream/InvokeModel on the model
  3. Check the model is available and enabled in the configured AWS region
  4. If throttled (TooManyRequests), add retries/backoff or request a quota increase

Example fix

// before
model: "anthropic.claude-v2" // not available in region
// after
model: "anthropic.claude-3-5-sonnet-20240620-v1:0" // enabled in us-east-1
Defensive patterns

Strategy: retry

Validate before calling

// Pre-flight: ensure the model exists and credentials work
const ok = await bedrock.listFoundationModels();
const valid = ok.modelSummaries?.some(m => m.modelId === MODEL_ID);

Type guard

function isBedrockServiceError(e: unknown): e is { name: string; message: string } {
  return typeof e === 'object' && e !== null && 'message' in e;
}

Try / catch

try {
  await bedrock.invoke(req);
} catch (e) {
  if (e.name === 'ThrottlingException') await backoffRetry();
  else if (e.name === 'AccessDeniedException') checkIamPermissions();
  else throw e;
}

Prevention

When it happens

Trigger: An SdkError::ServiceError from a bedrockruntime invoke/converse call: invalid model ID, throttling, access denied, malformed request body, model not available in region, or context length exceeded.

Common situations: Wrong modelId string in AI provider config; AWS credentials/IAM policy lacking bedrock:InvokeModel; model not enabled in the AWS region; exceeding input token limits.

Related errors


AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03). Data as JSON: /api/errors/9dc3a028c23d9f3d. Report an issue: GitHub.