The maximum length for a filter value is 255 characters

Hi all,

I’m getting the following error with the latest 2.16 and 2.17` when trying to create EC2 instance:

botocore.exceptions.ClientError: An error occurred (FilterLimitExceeded) when calling the DescribeInstances operation: The maximum length for a filter value is 255 characters

using the ec2_instance module:

  - name: launch ec2 instance
    ec2_instance:
      state: "running"
      region: "{{ region }}"
      key_name: "{{ keypair }}"
      network:
         assign_public_ip: true
         groups: "{{ group }}"
      instance_type: "{{ ec2_instance_type }}"
      vpc_subnet_id: "{{ vpc_subnet }}"
      image_id: "{{ image_id }}"

Seems the module is running DescribeInstances at some point and failing due to the filter expression being over 255 characters long, as per my understanding.

Anyone has any idea why is this happening?

List of python modules:

$ pip3 list
Package         Version
--------------- -----------
ansible         10.6.0
ansible-core    2.17.6
boto3           1.35.63
botocore        1.35.63
cffi            1.17.1
cryptography    43.0.3
Jinja2          3.1.4
jmespath        1.0.1
MarkupSafe      3.0.2
packaging       24.2
pip             24.0
pycparser       2.22
python-dateutil 2.9.0.post0
PyYAML          6.0.2
resolvelib      1.0.1
s3transfer      0.10.3
six             1.16.0
urllib3         2.2.3

The OS is Ubuntu-24.04.1 running Python 3.12.3

Thanks in advance for your input.