Skip to content

EC2: describe_* by explicit ID returns empty list instead of Invalid*ID.NotFound #391

Closed

Description

@scttfrdmn

Summary

ec2:Describe* calls that filter by explicit resource ID return 200 with an empty
list when the ID does not exist. Real EC2 raises a Client.Invalid<Type>ID.NotFound
error. It also accepts syntactically invalid IDs, where real EC2 raises
Invalid<Type>ID.Malformed.

This is the "absent vs. filtered" distinction: describe_vpcs() with no arguments
legitimately returns [], but describe_vpcs(VpcIds=["vpc-dead"]) is an assertion
that the ID exists, and EC2 answers it with an error.

Reproduction

Against ghcr.io/scttfrdmn/substrate:0.76.0:

ec2 = boto3.client("ec2", endpoint_url="http://localhost:4566", region_name="us-east-1")

ec2.describe_vpcs(VpcIds=["vpc-0000000000000dead"])             # -> 200 {"Vpcs": []}
ec2.describe_subnets(SubnetIds=["subnet-0000000000000dead"])    # -> 200 {"Subnets": []}
ec2.describe_security_groups(GroupIds=["sg-0000000000000dead"]) # -> 200 {"SecurityGroups": []}
ec2.describe_instances(InstanceIds=["i-0000000000000dead"])     # -> 200 {"Reservations": []}
ec2.describe_vpcs(VpcIds=["not-an-id"])                         # -> 200 {"Vpcs": []}

Expected

Call AWS error code
describe_vpcs(VpcIds=[missing]) InvalidVpcID.NotFound
describe_subnets(SubnetIds=[missing]) InvalidSubnetID.NotFound
describe_security_groups(GroupIds=[missing]) InvalidGroup.NotFound
describe_instances(InstanceIds=[missing]) InvalidInstanceID.NotFound
describe_vpcs(VpcIds=["not-an-id"]) InvalidVpcID.Malformed

Note AWS's inconsistent casing, which is worth mirroring exactly: InvalidVpcID
and InvalidSubnetID but InvalidGroupId.Malformed (lowercase d) and
InvalidGroup.NotFound (no Id at all).

Why it matters

This makes a whole class of validation logic untestable rather than merely
differently-shaped. A concrete case from parsl-ephemeral-aws, whose entire
network-precondition check is built on these codes:

try:
    ec2.describe_vpcs(VpcIds=[self.vpc_id])
except ClientError as e:
    if e.response["Error"]["Code"] in ("InvalidVpcID.NotFound", "InvalidVpcID.Malformed"):
        raise ResourceNotFoundError(f"vpc_id {self.vpc_id} is not usable ...")

Against substrate this code path is unreachable: the call succeeds, the guard is
skipped, and a test asserting "a deleted VPC is reported clearly" passes while
verifying nothing. describe_instances returning [] instead of raising is the
same hazard in status-polling loops, which commonly read
Reservations[0]["Instances"][0] and would get IndexError instead of the
InvalidInstanceID.NotFound they handle.

Emulators that return success where AWS errors are worse than ones that are merely
incomplete, because the test suite reports green.

Activity

  1. added
    type: bug
    priority: high
    on Jul 30, 2026
  2. added this to the v0.78.0 milestone on Jul 31, 2026
  3. added a commit that references this issue on Aug 1, 2026
    8b4e3f0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: ec2priority: hightype: bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions