## TL;DR

The 503 from the OCE API while listing instances via the SDK was resolved by skipping OCE processing when excluded: at the top of \_\_load\_paas\_oce, return [] early when the exclude flags contain oce_instance or oce.

## Steps

1. The 503 from the OCE API while listing instances via the SDK was resolved by skipping OCE processing when excluded: at the top of `__load_paas_oce`, return [] early when the exclude flags contain oce_instance or oce. Also wrap the per-compartment `oci.pagination.list_call_get_all_results(oce_client.list_oce_instances, compartment_id=...)` call in try/except and return [] on failure, so one bad compartment does not kill the whole listing.

## When to use

You are seeing this: Issue oracle/oci-python-sdk#854 (closed, 7 comments): Description: We are running an OCI inventory script using the Oracle Python SDK to list all services across compartments and regions. Use this skill when you run into "OCI OCE API returning 503 ServiceUnavailable while listing instances via SDK".

## When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

## Versions

No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.

## Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.

## Edge cases

- Also wrap the per-compartment oci.pagination.list\_call\_get\_all\_results(oce\_client.list\_oce\_instances, compartment\_id=...) call in try/except and return [] on failure, so one bad compartment does not kill the whole listing.
