Anyone hitting the below error when running claude code?
⎿ API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"The request body is not valid JSON: invalid high surrogate in string: line 47 column 5162 (char 45482)"}}
As the error says, you must provide the ID of an inference profile and not the model for this particular model. The easiest way to do this is to provide the ID of a system-defined inference profile for this model. You can find it by invoking this awscli command with the correct credentials defined in the environment (or set via standard flags):
aws bedrock list-inference-profiles
You will see this one in the JSON list:
{
"inferenceProfileName": "US Anthropic Claude 3.5 Sonnet v2",
"description": "Routes requests to Anthropic Claude 3.5 Sonnet v2 in us-west-2, us-east-1 and us-east-2.",
"inferenceProfileArn": "arn:aws:bedrock:us-east-1:381492273274:inference-profile/us.anthropic.claude-3-5-sonnet-20241022-v2:0",
"models": [
{
"modelArn": "arn:aws:bedrock:us-west-2::foundation-model/anthropic.claude-3-5-sonnet-20241022-v2:0"
},
{
"modelArn": "arn:aws:bedrock:us-east-1::foundation-model/anthropic.claude-3-5-sonnet-20241022-v2:0"
},
{
"modelArn": "arn:aws:bedrock:us-east-2::foundation-model/anthropic.claude-3-5-sonnet-20241022-v2:0"
}
],
"inferenceProfileId": "us.anthropic.claude-3-5-sonnet-20241022-v2:0",
"status": "ACTIVE",
"type": "SYSTEM_DEFINED"
}
Modify the invoke_model line in your code to specify the ID or ARN of the inference profile instead:
response = bedrock_runtime.invoke_model(
body=body,
modelId="us.anthropic.claude-3-5-sonnet-20241022-v2:0",
)
You can add the ARN of an Inference profile to your modelID itself while invoking the model.
response = bedrock_client.invoke_model(
modelId="arn:aws:bedrock:us-east-1::model/your-bedrock-model-arn"
prompt="Your prompt here"
)
I don't understand how to fix this issue.
I understand the issue, but I don't know how to stop Roo from repeating the same prompt repeatedly or how to modify the prompt it's trying to send.
I've tried to switch models. But still get the same error. This is with claude 3-7.