Select Language:
If you’re working with BedrockAgentCore Memory in AWS and trying to add multiple custom memory strategies, you might run into an error that says “Invalid Bedrock model ID,” especially when adding a second strategy that uses semanticOverride with the same model ID. Here’s a straightforward way to solve this issue.
When deploying your AWS::BedrockAgentCore::Memory resource, you can set up one custom memory strategy that uses semanticOverride.consolidation and another with summaryOverride.consolidation without problems. However, issues arise when you try to add a second customMemoryStrategy that also uses semanticOverride.consolidation with the same model ID, even if you change the namespace or location.
In such cases, the deployment will fail with a message like:
“Validation failed during UpdateMemory: Invalid Bedrock model ID (BedrockAgentCoreControl, 400).”
Interestingly, before adding the second strategy, using the same model ID was working fine. This suggests that the error might not be about the model ID itself but possibly about how many semanticOverride strategies you can define per memory resource.
To address this, consider these questions:
– Is there a limit to how many semanticOverride strategies you can have within one memory resource?
– If multiple semantic strategies are supported, what rules apply? Do they require unique names, specific formats, or particular namespace patterns?
– Can the error message be clearer? It’s confusing because the same model ID works in one strategy but not when duplicated in another.
An important thing to check is whether the model ID you’re referencing is still valid. For example, if the model ID was valid when you initially deployed your stack but has since been removed or deprecated, it could cause these errors. Updating or replacing the model ID with a currently active one should help.
For clarity, here’s what your memory strategies setup looks like:
json
{
“memoryStrategies”: [
{
“customMemoryStrategy”: {
“name”: “semantic_custom”,
“namespaces”: [“/events/{actorId}”],
“configuration”: {
“semanticOverride”: {
“consolidation”: {
“appendToPrompt”: “Your custom prompt here”,
“modelId”: “your-current-model-id”
}
}
}
}
},
{
“customMemoryStrategy”: {
“name”: “semantic_pre”,
“namespaces”: [“/pre_events/{actorId}”],
“configuration”: {
“semanticOverride”: {
“consolidation”: {
“appendToPrompt”: “Your pre-event prompt here”,
“modelId”: “your-current-model-id”
}
}
}
}
},
{
“customMemoryStrategy”: {
“name”: “session_summarizer_with_consistency”,
“type”: “SUMMARIZATION”,
“namespaces”: [“/events/{actorId}/{sessionId}”],
“configuration”: {
“summaryOverride”: {
“consolidation”: {
“appendToPrompt”: “Your summary prompt here”,
“modelId”: “your-current-model-id”
}
}
}
}
}
]
}
If removing or changing the second semantic strategy resolves the deployment issue, then the problem is likely related to the constraints on multiple semanticOverride strategies with identical model IDs within a single memory resource.
Always verify that the model ID you’re referencing is valid and active. If it was valid initially but has since been deprecated or deleted, you’ll need to use a different, current model ID.
Ensuring uniqueness in strategy names and following any documented constraints can prevent future errors. If the supported limits are unclear, consulting AWS documentation or reaching out to support can provide clarification.




