conductor-oss/conductor · error · RuntimeException

Unsupported model {modelId}

Error message

Unsupported model {modelId}

What it means

Bedrock.generateEmbeddings() validates the embedding model ID before making any AWS API call: it only accepts model IDs prefixed with 'cohere.' because the request body is hardcoded to Cohere's format (input_type, embedding_types, texts). Any other model ID — Amazon Titan, OpenAI, etc. — is rejected immediately. This is a deliberate design constraint, not a bug: the request body construction in getEmbeddingRequest() is Cohere-specific.

Source

Thrown at ai/src/main/java/org/conductoross/conductor/ai/providers/bedrock/Bedrock.java:64

    public static final String NAME = "bedrock";
    private final BedrockConfiguration config;

    public Bedrock(BedrockConfiguration config) {
        this.config = config;
    }

    @Override
    public String getModelProvider() {
        return NAME;
    }

    @SneakyThrows
    @Override
    public List<Float> generateEmbeddings(EmbeddingGenRequest embeddingGenRequest) {
        String modelId = embeddingGenRequest.getModel();
        if (!modelId.startsWith("cohere.")) {
            throw new RuntimeException("Unsupported model " + modelId);
        }
        var client =
                BedrockRuntimeClient.builder()
                        .credentialsProvider(config.getAwsCredentialsProvider())
                        .region(Region.of(config.getRegion()))
                        .build();
        Map<String, Object> requestMap =
                getEmbeddingRequest(embeddingGenRequest.getModel(), embeddingGenRequest.getText());
        byte[] body = om.writeValueAsBytes(requestMap);
        InvokeModelRequest request =
                InvokeModelRequest.builder()
                        .modelId(modelId)
                        .body(SdkBytes.fromByteArray(body))
                        .build();
        InvokeModelResponse response = client.invokeModel(request);
        byte[] byteArray = response.body().asByteArray();
        Map<String, Map<String, Object>> ressMap = om.readValue(byteArray, Map.class);
        List<List<Float>> floats = (List<List<Float>>) ressMap.get("embeddings").get("float");

View on GitHub (pinned to cf7c3e4a8a)

Solutions

  1. Use a Cohere embedding model ID: 'cohere.embed-english-v3', 'cohere.embed-multilingual-v3', etc.
  2. If you need Amazon Titan or another non-Cohere embedding model, extend the Bedrock provider to handle their request/response formats, or use a different provider that supports them.
  3. Validate the model ID before calling generateEmbeddings if building a dynamic workflow.

Example fix

// before
String modelId = "amazon.titan-embed-text-v2:0";
List<Float> embeddings = bedrock.generateEmbeddings(
    new EmbeddingGenRequest(modelId, text, null));

// after
String modelId = "cohere.embed-english-v3";
List<Float> embeddings = bedrock.generateEmbeddings(
    new EmbeddingGenRequest(modelId, text, null));
Defensive patterns

Strategy: validation

Validate before calling

// Validate model ID before calling Bedrock embeddings
void validateBedrockEmbeddingModel(String modelId) {
    if (modelId == null || !modelId.startsWith("cohere.")) {
        throw new IllegalArgumentException(
            "Bedrock embeddings only support Cohere models (prefix 'cohere.'). "
            + "Got: " + modelId + ". "
            + "Valid: cohere.embed-english-v3, cohere.embed-multilingual-v3");
    }
}

Try / catch

try {
    return bedrock.generateEmbeddings(request);
} catch (RuntimeException e) {
    if (e.getMessage().startsWith("Unsupported model")) {
        throw new IllegalArgumentException(
            "Use a Cohere embedding model (cohere.*) for Bedrock. Got: "
            + request.getModel(), e);
    }
    throw e;
}

Prevention

When it happens

Trigger: Calling generateEmbeddings on a Bedrock provider with a model ID that does not start with 'cohere.', such as 'amazon.titan-embed-text-v2:0', 'amazon.titan-embed-g1-text-02', or any non-Cohere embedding model available on Bedrock.

Common situations: Assuming the Bedrock provider supports all embedding models listed in the AWS Bedrock model catalog. Copying a model ID from AWS documentation for Titan embeddings and using it with this provider. Workflow config referencing a Bedrock embedding model from a different family.

Related errors


AI-assisted analysis of conductor-oss/conductor@cf7c3e4a8a (2026-08-14). Data as JSON: /api/errors/99fddc9b2569bdb6. Report an issue: GitHub.