Skip to content

VCN delete IncorrectState error does not identify which gateway is blocking deletion #1108

Description

@surapuramakhil

Description

When deleting a VCN that still has any gateway attached (IGW, NAT Gateway, Service Gateway, Local Peering Gateway, or DRG attachment), the error message is generic and does not identify which gateway type or OCID is the blocker.

Steps to Reproduce

  1. Create a VCN with multiple gateway types (IGW, NAT GW, Service GW).
  2. Attempt to delete the VCN without first detaching/deleting the gateways.
oci network vcn delete --vcn-id $VCN_ID --force

Expected Behaviour

The error message should identify the specific gateway type and OCID that is blocking the deletion:

message: <vcn-ocid> is associated with Service Gateway <ocid1.servicegateway...> — delete that gateway first.

Actual Behaviour

The error returned is identical for all 5 gateway types:

TransientServiceError:
  code: IncorrectState
  message: <vcn-ocid> is associated with Gateway that is in use

This gives no indication of which gateway is the blocker. Users must enumerate all 5 gateway types manually to discover the culprit.

Impact

In our session, we deleted the IGW and NAT GW, received a "vcn delete would now work" impression — but a Service Gateway (auto-created when the VCN was built, never manually added) was still attached. The VCN delete failed again with the same generic "Gateway that is in use" message, costing ~40 minutes of debug time.

Suggested Fix

Include the gateway type and OCID in the IncorrectState error message. OCI already has this data internally; it's just not surfaced in the error response. Even a simple enumeration like:

message: VCN <ocid> is still associated with the following gateways: [Service Gateway (ocid1.servicegateway...), NAT Gateway (ocid1.natgateway...)]. Delete or detach them first.

This would be a significant UX improvement for infrastructure teardown workflows.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions