spring-projects/spring-ai · error · IllegalArgumentException

InputType property for BedrockTitanEmbeddingModel is missing

Error message

InputType property for BedrockTitanEmbeddingModel is missing.

What it means

BedrockTitanEmbeddingModel requires an input type (e.g. CLUSTERING, SEARCH_DOCUMENT, SEARCH_IMAGE) that controls how Titan builds embeddings. The auto-configuration throws this IllegalArgumentException when spring.ai.bedrock.titan.embedding.input-type is not set, even though the API bean was created successfully.

Source

Thrown at auto-configurations/models/spring-ai-autoconfigure-model-bedrock-ai/src/main/java/org/springframework/ai/model/bedrock/titan/autoconfigure/BedrockTitanEmbeddingAutoConfiguration.java:80

		// Validate required properties
		if (properties.getModel() == null || awsProperties.getTimeout() == null) {
			throw new IllegalArgumentException("Required properties for TitanEmbeddingBedrockApi are missing.");
		}

		return new TitanEmbeddingBedrockApi(properties.getModel(), credentialsProvider, regionProvider.getRegion(),
				jsonMapper, awsProperties.getTimeout());
	}

	@Bean
	@ConditionalOnMissingBean
	@ConditionalOnBean(TitanEmbeddingBedrockApi.class)
	public BedrockTitanEmbeddingModel titanEmbeddingModel(TitanEmbeddingBedrockApi titanEmbeddingApi,
			BedrockTitanEmbeddingProperties properties, ObjectProvider<ObservationRegistry> observationRegistry) {

		// Validate required properties
		if (properties.getInputType() == null) {
			throw new IllegalArgumentException("InputType property for BedrockTitanEmbeddingModel is missing.");
		}

		return new BedrockTitanEmbeddingModel(titanEmbeddingApi,
				observationRegistry.getIfUnique(() -> ObservationRegistry.NOOP))
			.withInputType(properties.getInputType());
	}

}

View on GitHub (pinned to 98a7beda4f)

Solutions

  1. Set spring.ai.bedrock.titan.embedding.input-type to one of the supported enum values (e.g. SEARCH_DOCUMENT, CLUSTERING).
  2. Use only valid TitanEmbeddingModel.TitanEmbeddingInputType enum names — invalid names would fail binding with a different error.
  3. Confirm the property key spelling and prefix match the current Spring AI version's BedrockTitanEmbeddingProperties.

Example fix

// before
spring.ai.bedrock.titan.embedding.model=amazon.titan-embed-text-v2:0
// after
spring.ai.bedrock.titan.embedding.model=amazon.titan-embed-text-v2:0
spring.ai.bedrock.titan.embedding.input-type=SEARCH_DOCUMENT
Defensive patterns

Strategy: validation

Validate before calling

if (env.getProperty("spring.ai.bedrock.titan.embedding.input-type") == null)
    throw new IllegalStateException("Set spring.ai.bedrock.titan.embedding.input-type (e.g. SEARCH_DOCUMENT)");

Prevention

When it happens

Trigger: titanEmbeddingModel bean method runs with properties.getInputType() == null — the embedding API bean exists but no input-type property was configured.

Common situations: Adding the Titan embedding starter and model id but forgetting input-type; renaming/moving properties during migration so the input-type key no longer binds.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


AI-assisted analysis of spring-projects/spring-ai@98a7beda4f (2026-09-11). Data as JSON: /api/errors/26686fa85f2eeddb. Report an issue: GitHub.