Skip to content

bug: agentcore dev fails on mismatched regions #1457

@Hweinstock

Description

@Hweinstock

Problem

Invoking local agent is failing with memory not found:

Web UI: [MyAgent1] {"timestamp": "2026-06-03T17:24:11.698Z", "level": "ERROR", "message": "Error in sync streaming", "logger": "bedrock_agentcore.app", "requestId": "********-****-****-****-************",
   "sessionId": "********-****-****-****-************", "errorType": "ResourceNotFoundException", "errorMessage": "An error occurred (ResourceNotFoundException) when calling the ListEvents operation: Memory not
   found: ************************************", "stackTrace": ["Traceback (most recent call last):\n", "  File \"/****/app/MyAgent1/.venv/lib/python3.10/site-packages/bedrock_agentcore/runtime/app.py\", line 886,
   in _sync_stream_with_error_handling\n    for value in generator:\n", "  File \"/****/app/MyAgent1/.venv/lib/python3.10/site-packages/bedrock_agentcore/runtime/app.py\", line 747, in _async_gen_to_sync_gen\n
   raise value\n", "  File \"/****/app/MyAgent1/.venv/lib/python3.10/site-packages/bedrock_agentcore/runtime/app.py\", line 736, in _produce\n    async for chunk in async_gen:\n", "  File
   \"/****/app/MyAgent1/main.py\", line 60, in invoke\n    agent = get_or_create_agent(session_id, user_id)\n", "  File \"/****/app/MyAgent1/main.py\", line 45, in get_or_create_agent\n
   session_manager=get_memory_session_manager(session_id, user_id),\n", "  File \"/****/app/MyAgent1/memory/session.py\", line 20, in get_memory_session_manager\n    return AgentCoreMemorySessionManager(\n", "
   File \"/****/app/MyAgent1/.venv/lib/python3.10/site-packages/bedrock_agentcore/memory/integrations/strands/session_manager.py\", line 202, in __init__\n    super().__init__(session_id=self.config.session_id,
   session_repository=self)\n", "  File \"/****/app/MyAgent1/.venv/lib/python3.10/site-packages/strands/session/repository_session_manager.py\", line 51, in __init__\n    session =
   session_repository.read_session(session_id)\n", "  File \"/****/app/MyAgent1/.venv/lib/python3.10/site-packages/bedrock_agentcore/memory/integrations/strands/session_manager.py\", line 318, in read_session\n
   events = self.memory_client.list_events(\n", "  File \"/****/app/MyAgent1/.venv/lib/python3.10/site-packages/bedrock_agentcore/memory/client.py\", line 887, in list_events\n    response =
   self.gmdp_client.list_events(**params)\n", "  File \"/****/app/MyAgent1/.venv/lib/python3.10/site-packages/botocore/client.py\", line 606, in _api_call\n    return self._make_api_call(operation_name, kwargs)\n",
   "  File \"/****/app/MyAgent1/.venv/lib/python3.10/site-packages/opentelemetry/instrumentation/botocore/__init__.py\", line 334, in _patched_api_call\n    result = original_func(*args, **kwargs)\n", "  File
   \"/****/app/MyAgent1/.venv/lib/python3.10/site-packages/botocore/context.py\", line 123, in wrapper\n    return func(*args, **kwargs)\n", "  File
   \"/****/app/MyAgent1/.venv/lib/python3.10/site-packages/botocore/client.py\", line 1094, in _make_api_call\n    raise error_class(parsed_response, operation_name)\n",
   "botocore.errorfactory.ResourceNotFoundException: An error occurred (ResourceNotFoundException) when calling the ListEvents operation: Memory not found: ************************************\n"], "location":
   "/****/app/MyAgent1/.venv/lib/python3.10/site-packages/bedrock_agentcore/runtime/app.py:_sync_stream_with_error_handling:889"}

The issue appears to be that the CLI does not inject the AWS_REGION env var into the local agent subprocess. This causes boto3 to try to fallback to a default that may not match the region that resoruces are deployed in. (source: https://docs.aws.amazon.com/boto3/latest/guide/configuration.html).

For example, my memory was in us-east-1, but its searching us-west-2.

Potential Fix

Looks like we may need to add the region from the aws-targets.json to the dev env here: https://github.com/aws/agentcore-cli/blob/main/src/cli/operations/dev/load-dev-env.ts#L16.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions