Oracle 'Out of host capacity': retry it safely
Your Always Free A1 launch keeps failing with Out of host capacity. Build a retry on a pinned OCI CLI that checks capacity and stops on errors it cannot fix.
Why Oracle says Out of host capacity
Oracle's "Out of host capacity" error means Oracle has no free physical host for the shape you asked for, in the availability domain you asked for. Your request is not wrong. You can only ask again later, or ask somewhere else inside your home region. This guide builds a retry script for the Always Free VM.Standard.A1.Flex shape that asks politely. It makes one attempt per availability domain per run and checks capacity before each launch. It waits longer after each failure, and it stops for good on errors that no retry can fix.
The README of the hitrov/oci-arm-host-capacity project shows the error body like this:
{ "code": "InternalError", "message": "Out of host capacity." }Oracle's Compute known issues page describes the same failure. The launch fails "with the error code InternalError and a message similar to Out of host capacity". The cause is "a lack of physical infrastructure capacity for the shape in the requested fault domain and availability domain". Note the words "similar to". The script below matches the message loosely and ignores case. It also does not depend on one HTTP status code, because neither that page nor the README names one.
The same page lists Oracle's workarounds. Check capacity first with the CreateComputeCapacityReport operation. Create the instance in a different availability domain, or without naming a fault domain. Use a smaller shape or a shape in a different series. Or wait a few minutes and try again. A shape in a different series means leaving A1, so the script uses the other options. The page also says capacity "usually becomes available soon for most shapes". That sentence is about shapes in general. For Always Free capacity, Oracle's Free Tier FAQ says more capacity "might take several days" to reach your home region. Plan for days, not minutes.
What the Always Free A1 rules allow
These rules come from Oracle's Always Free resources page as of 1 December 2026.
- Always Free compute instances must be created in your home region. A retry in another region cannot give you a free instance.
- The A1 allowance is the first 1,500 OCPU hours and 9,000 GB hours per month on
VM.Standard.A1.Flex. For Always Free tenancies, Oracle says this equals 2 OCPUs and 12 GB of memory. You can use it as one instance, or as two instances of 1 OCPU each. - In Oracle's words, you can create A1 instances "in any availability domain, except South Korea North (Chuncheon)". If Chuncheon is your home region, retrying will not get you a free A1 instance.
- The boot volume defaults to 50 GB. The page gives 47 GB as the minimum in one place and 50 GB in another. Oracle's Block Volume docs say a custom boot volume must be larger than the image default or 50 GB, whichever is higher, and the CLI reference gives 50 GB as the minimum. The script leaves the size unset, so you get the default. Boot and block volumes share 200 GB of Always Free storage in total.
Other Oracle pages still show higher A1 figures. Oracle's Arm reference page and its price list both say 3,000 OCPU hours and 18,000 GB hours a month. An older Oracle blog post says 4 cores and 24 GB. The Always Free page gives the lower figures for Always Free tenancies. Size your request to the Always Free page: 2 OCPUs and 12 GB. For paid tenancies, Oracle's price list explicitly gives the higher allowance: the first 3,000 OCPU hours and 18,000 GB hours per month are free, shared across A1 bare metal, virtual machine and container instances.
Install a pinned OCI CLI
Pin the CLI version, so the script's behaviour does not change under you. The current release is oci-cli 3.97.1, published to PyPI on 25 November 2026. Do not pin 3.97.0. PyPI marks it as yanked, with the reason "wrong oci dependency version". Oracle recommends installing the CLI in a virtual environment, which also keeps it away from your system Python.
Run this on a Linux machine you already have that stays on, such as a home server or a small VPS. The script needs no open inbound ports.
sudo apt update && sudo apt install -y python3-venv
python3 -m venv ~/oci-venv
~/oci-venv/bin/pip install oci-cli==3.97.1
~/oci-venv/bin/oci --versionThe last command should report 3.97.1. Oracle's table of tested Python setups covers Oracle Linux 8 and 9, Ubuntu 20.04 and Windows. Ubuntu 24.04 is not in that table. Oracle says the CLI "might work on unlisted operating systems", but it does not test them. If the install fails, check this first.
Now create the config file and an API key pair:
~/oci-venv/bin/oci setup configThe command asks for the information it needs, then writes ~/.oci/config and the API public and private keys. Choose your home region at the region prompt. Then upload the public key in the Console: Profile menu, User settings, Token and keys, Add API Key. Lock down the private key as Oracle advises (use the file name oci setup config printed, if yours differs):
chmod go-rwx ~/.oci/oci_api_key.pemA passphrase on the key is a problem for an unattended job, because cron cannot type it. Oracle marks the passphrase entry in the config file as deprecated and says to avoid saving confidential information there. For this job, the practical choice is a key without a passphrase, readable only by your user, on a machine you trust.
Find your home region and its availability domains
Rotating through availability domains only helps if your region has more than one. Oracle's regions page lists the count for each region. As of 1 December 2026, most commercial regions have one. Frankfurt, London, Ashburn, Chicago and Phoenix have three. Seoul, Chuncheon, Tokyo, Singapore and San Jose have one. Check your own region's row on that page before you rely on this list.
Oracle randomizes availability domain names per tenancy to balance capacity. A name copied from a forum post will not work in your account, so list your own:
~/oci-venv/bin/oci iam region-subscription list
~/oci-venv/bin/oci iam availability-domain list --query 'data[].name'In the first output, the entry with is-home-region set to true is your home region. Your CLI profile must point at it. The second command lists the availability domains of your tenancy, and the names look like Uocm:PHX-AD-1. If both commands fail with an authentication error, check the API key upload, config and system clock.
Fault domains are the other setting. Each availability domain contains three. If you do not name one, the system selects one for you. Oracle lists "don't specify a Fault Domain" as one of its fixes for this error, so the script never passes --fault-domain.
Collect the IDs the launch needs
oci compute instance launch requires an availability domain, a compartment and a subnet. A real launch also needs a shape, a shape config and an image. The subnet must already exist. If you have none, create a VCN (virtual cloud network) with a public subnet in the Console first. On a public subnet, the instance gets a public IP by default.
The compartment can be the root compartment. Its OCID (Oracle Cloud ID) is your tenancy OCID, on the tenancy= line of ~/.oci/config. The capacity report must always use the root compartment. List your subnets and the images built for the A1 shape:
C=ocid1.tenancy.oc1..replace-with-your-tenancy-ocid
~/oci-venv/bin/oci network subnet list --compartment-id "$C" \
--query 'data[].{name:"display-name", id:id}' --output table
~/oci-venv/bin/oci compute image list --compartment-id "$C" \
--shape VM.Standard.A1.Flex \
--query 'data[].{name:"display-name", id:id}' --output tableThe Always Free A1 images are Oracle Linux, Ubuntu, and Oracle Linux Cloud Developer. The Cloud Developer image requires at least 8 GB of memory. You also need an SSH public key. If you have none, create one with ssh-keygen -t ed25519. The launch puts it in ~/.ssh/authorized_keys for the image's default user.
Create the working folder and the capacity report input. The field names come from Oracle's SDK models for the report:
mkdir -p ~/a1-retry
printf '%s\n' '[{"instanceShape":"VM.Standard.A1.Flex","instanceShapeConfig":{"ocpus":2,"memoryInGBs":12}}]' > ~/a1-retry/shape.jsonThen write ~/a1-retry/a1.env with your own values. Put the exact availability domain names from the list command into ADS, separated by spaces. In a one-domain region, ADS holds one name.
TENANCY_OCID="ocid1.tenancy.oc1..replace-me"
COMPARTMENT_OCID="ocid1.tenancy.oc1..replace-me"
SUBNET_OCID="ocid1.subnet.oc1.replace-me"
IMAGE_OCID="ocid1.image.oc1.replace-me"
ADS="Uocm:PHX-AD-1 Uocm:PHX-AD-2 Uocm:PHX-AD-3"
NAME="a1-free-1"
SHAPE_CONFIG='{"ocpus":2,"memoryInGBs":12}'
SSH_PUBKEY="$HOME/.ssh/id_ed25519.pub"If your API user is not an administrator, it needs the COMPUTE_CAPACITY_REPORT_CREATE permission. The manage verb on compute-capacity-reports grants it.
Why the script passes --no-retry
By default the CLI retries failed calls by itself. oci-cli 3.97.1 uses the Python SDK's default retry strategy. In SDK 2.193.0 that strategy makes up to 8 attempts within 600 seconds. It retries timeouts and connection errors, 429, 409 with IncorrectState or LockConflict, and any 5xx status except 501. So if the capacity error comes back as a 5xx, one CLI call can keep retrying for up to ten minutes. That overlaps the next scheduled run and hides the real request rate from you. The global --no-retry option turns this off, so the script's own backoff decides how often Oracle is asked. It cannot be combined with --max-retries.
The second detail is how a failure looks. On a service error, the CLI prints ServiceError: followed by a details block, and it exits through Python's sys.exit with that text. Python prints that text to stderr and exits with code 1. Every service error gives the same exit code 1, which means the exit code alone cannot tell a capacity error from a wrong OCID. The script captures stderr together with stdout (2>&1) and reads the error code from the text.
Which errors to retry, and which to stop on
Oracle's API errors page says, for each code, whether a retry makes sense:
- Out of host capacity (code
InternalError): retry. Try the next availability domain, then wait. - 429 TooManyRequests: "Yes, with backoff." Oracle recommends exponential backoff "starting from a few seconds to a maximum of 60 seconds". The script's runs are already minutes apart, so it only doubles its own wait.
- 400 LimitExceeded: "No." The request exceeds an Oracle-defined limit for the tenancy. The hitrov README shows this error naming
standard-a1-memory-countandstandard-a1-core-countwhen instances already use the allowance. - 400 QuotaExceeded, 400 InvalidParameter, 401 NotAuthenticated, 404 NotAuthorizedOrNotFound: also "No." Something in your config or IDs is wrong. Stop and fix it.
The table's own 500 code is InternalServerError, marked retryable with backoff. The capacity error uses InternalError, and the table does not mention "Out of host capacity" at all. The script treats both as retryable.
One more risk is a lost reply. A launch request can time out after Oracle has already accepted it. Oracle's API has retry tokens for this case. The script uses a simpler check instead: before every launch, it lists instances with your display name and stops if one exists in any state other than TERMINATED or TERMINATING. Display names do not have to be unique, so pick a name you use for nothing else.
The retry script
Save this as ~/a1-retry/a1-retry.sh. Each run makes one pass and exits. It never loops on its own, because the scheduler decides when the next pass happens.
#!/bin/bash
# a1-retry.sh: one polite pass at launching an Always Free A1 instance.
set -u
DIR="$HOME/a1-retry"
OCI="$HOME/oci-venv/bin/oci"
. "$DIR/a1.env"
exec >>"$DIR/a1-retry.log" 2>&1
now=$(date +%s)
say() { echo "$(date -u +%FT%TZ) $*"; }
stop() { say "STOP: $*"; echo "$*" > "$DIR/STOP"; exit 0; }
backoff() {
wait_s=$(cat "$DIR/wait_s" 2>/dev/null || echo 300)
echo $(( now + wait_s )) > "$DIR/next_try"
next_wait=$(( wait_s * 2 ))
[ "$next_wait" -gt 1800 ] && next_wait=1800
echo "$next_wait" > "$DIR/wait_s"
say "$*; next try in ${wait_s}s"
exit 0
}
# 1. A STOP file means success, or an error that retrying cannot fix.
[ -e "$DIR/STOP" ] && exit 0
# 2. Respect the wait set by the last failure.
next_try=$(cat "$DIR/next_try" 2>/dev/null || echo 0)
[ "$now" -lt "$next_try" ] && exit 0
# 3. Never launch twice: stop if a live instance with this name exists.
Q="length(data[?\"lifecycle-state\"!='TERMINATED' && \"lifecycle-state\"!='TERMINATING'])"
if ! live=$("$OCI" --no-retry compute instance list \
--compartment-id "$COMPARTMENT_OCID" --display-name "$NAME" \
--query "$Q" --raw-output); then
backoff "instance list failed, see the error above"
fi
[ "${live:-0}" -gt 0 ] 2>/dev/null && stop "an instance named $NAME already exists"
# 4. Try each availability domain once.
for AD in $ADS; do
status=$("$OCI" --no-retry compute compute-capacity-report create \
--availability-domain "$AD" --compartment-id "$TENANCY_OCID" \
--shape-availabilities "file://$DIR/shape.json" \
--query 'data."shape-availabilities"[0]."availability-status"' \
--raw-output) || status="report-failed"
say "$AD capacity report: ${status:-empty}"
case "$status" in
OUT_OF_HOST_CAPACITY|HARDWARE_NOT_SUPPORTED) continue ;;
esac
out=$("$OCI" --no-retry compute instance launch \
--availability-domain "$AD" --compartment-id "$COMPARTMENT_OCID" \
--subnet-id "$SUBNET_OCID" --image-id "$IMAGE_OCID" \
--shape VM.Standard.A1.Flex --shape-config "$SHAPE_CONFIG" \
--display-name "$NAME" --ssh-authorized-keys-file "$SSH_PUBKEY" \
--query 'data.id' --raw-output 2>&1)
if [ $? -eq 0 ]; then
rm -f "$DIR/next_try" "$DIR/wait_s"
stop "launched in $AD: $out"
fi
case "$out" in
*LimitExceeded*|*QuotaExceeded*) stop "tenancy limit or quota: $out" ;;
*NotAuthenticated*|*NotAuthorizedOrNotFound*|*InvalidParameter*)
stop "fix the config or IDs: $out" ;;
esac
if printf '%s' "$out" | grep -qiE 'out of host capacity|InternalError'; then
say "$AD: out of host capacity"
continue
fi
printf '%s' "$out" | grep -q 'TooManyRequests' && backoff "throttled (429)"
backoff "unexpected error in $AD: $out"
done
backoff "no capacity in: $ADS"chmod 700 ~/a1-retry/a1-retry.shWhat one run does, in order:
- It exits at once if
~/a1-retry/STOPexists. The script writes that file on success, and on any error that a retry cannot fix. - It exits if the wait from the last failure has not passed yet. The first wait is 300 seconds, and each failed pass doubles it, up to 1,800 seconds. Those numbers are a choice made here, not an Oracle figure. Oracle's 60-second guidance is for throttling, and a capacity shortage can last days.
- It stops if an instance with your display name exists in any live state. This check does not provide the API's retry-token guarantee against duplicate launches after a lost reply.
- For each availability domain, it asks the capacity report first. If the report says
OUT_OF_HOST_CAPACITYorHARDWARE_NOT_SUPPORTED, it skips the launch there. If the report saysAVAILABLE, fails, or returns something else, it launches anyway. AnAVAILABLEstatus is not a promise, and a failed report tells you nothing either way. - It reads the error code from the launch output. A limit, quota or config error writes
STOP. A capacity error moves on to the next availability domain. Anything else sets a longer wait.
The --query field names are derived from how the CLI prints results. It wraps them in data and turns underscores into hyphens. If every report line in your log says empty, run the report command once by hand without --query and compare the field names.
Run it once, then schedule it
Run one pass by hand and read the log:
bash ~/a1-retry/a1-retry.sh
tail -n 20 ~/a1-retry/a1-retry.logA healthy pass logs one capacity report line per availability domain. It then ends with either a STOP: launched line or a line ending in next try in 300s. A STOP: line about a limit, quota or authentication means you must fix the cause, then delete the stop file with rm ~/a1-retry/STOP.
Schedule it with cron
Open your crontab with crontab -e and add one line. Replace /home/youruser with your home directory.
*/5 * * * * flock -n /tmp/a1-retry.lock /bin/bash /home/youruser/a1-retry/a1-retry.shflock -n fails instead of waiting when the lock is held, so a slow pass never overlaps the next one. Cron runs the line with /bin/sh and treats an unescaped % as the start of standard input. Keep the date format strings inside the script file, as they are here, and never in the crontab line. flock is a Linux tool from util-linux, so do not expect it on macOS.
Schedule it with a systemd timer
A timer is the cleaner choice on a machine that runs systemd. Running a script with a systemd service and timer covers the unit files in depth. Here you need two user units. First ~/.config/systemd/user/a1-retry.service:
[Unit]
Description=One Always Free A1 launch pass
[Service]
Type=oneshot
ExecStart=/bin/bash %h/a1-retry/a1-retry.shThen ~/.config/systemd/user/a1-retry.timer:
[Unit]
Description=Run a1-retry 5 minutes after the last pass ends
[Timer]
OnActiveSec=1min
OnUnitInactiveSec=5min
[Install]
WantedBy=timers.targetOnUnitInactiveSec= counts from when the service last finished. If the service is still active when the timer fires, systemd leaves it running and does not start a second copy. Enable the timer, and turn on lingering so your user units keep running after you log out:
mkdir -p ~/.config/systemd/user
systemctl --user daemon-reload
systemctl --user enable --now a1-retry.timer
sudo loginctl enable-linger "$USER"
systemctl --user list-timers a1-retry.timerThe last command should list a1-retry.timer with a next run time. Without lingering, the user manager stops when you log out, and the timer stops with it. After a success, the script exits at once on every run, but you can still turn the timer off with systemctl --user disable --now a1-retry.timer.
Why not just run the hitrov script?
The best-known tool for this job is hitrov/oci-arm-host-capacity. The owner archived its repository on 13 August 2024, and it is now read-only, so it gets no fixes. Its OCI_OCPUS and OCI_MEMORY_IN_GBS settings default to 4 and 24. That is above the 2 OCPUs and 12 GB on Oracle's Always Free page today. Its README also describes a GitHub Actions mode, and warns that an endless run there violates GitHub's Terms of Use for Actions. That warning is about GitHub's terms, not Oracle's. The README's error samples are still useful, which is why this guide quotes them.
The honest exits: Pay As You Go or a small paid server
If days pass with no capacity, you have two other paths. Neither one guarantees capacity.
The first is upgrading the account to Pay As You Go. Oracle's billing docs say your credit card is authorized for $100 USD, or its equivalent in your country, when you upgrade. Oracle reverses the authorization on its side at once, but your bank decides how long the reversal takes. The upgrade itself "can take a day or two to complete". Oracle's Always Free page lists upgrading as one response to this error. Paid tenancies get the higher A1 free allowance of 3,000 OCPU hours and 18,000 GB hours per month in Oracle's price list. Still, nothing quoted in this guide says an upgraded account gets A1 capacity at once, so keep the retry running.
The second is a small paid server. If you only chose A1 because it was free, first check whether your software suits an Arm VPS or an x86 VPS, because an x86 plan avoids Arm build problems entirely. Then compare what a small VPS costs per month with the time you are spending on retries. A paid plan can be out of stock too, so confirm the plan is available in your location before you depend on it.
FAQ
Why does my Oracle A1 instance keep failing with Out of host capacity?
Oracle has no free physical host for VM.Standard.A1.Flex in the availability domain you asked for. The error code is InternalError, with a message similar to "Out of host capacity". Your settings are not the cause. Retry later, rotate through the other availability domains of your home region if it has more than one, and leave the fault domain unset. Oracle's Free Tier FAQ says new capacity might take several days to reach a home region.
Is the Always Free A1 allowance 2 OCPUs and 12 GB, or 4 OCPUs and 24 GB?
Oracle's Always Free resources page, as of 1 December 2026, gives 1,500 OCPU hours and 9,000 GB hours a month. It says that equals 2 OCPUs and 12 GB for Always Free tenancies. Oracle's price list explicitly gives paid tenancies the higher allowance of 3,000 OCPU hours and 18,000 GB hours per month, shared across A1 bare metal, virtual machine and container instances. For an Always Free tenancy, request 2 OCPUs and 12 GB, as one instance or as two instances of 1 OCPU each.
Can I create my free A1 instance in another region with more capacity?
No. Always Free compute instances must be created in your home region, so you can only rotate between availability domains inside that region. If your home region is South Korea North (Chuncheon), Oracle's Always Free page excludes it: A1 can be created "in any availability domain, except South Korea North (Chuncheon)".
Will upgrading to Pay As You Go fix Out of host capacity?
Not reliably. Upgrading changes how you are billed. Oracle's price list also gives paid tenancies a higher A1 free allowance of 3,000 OCPU hours and 18,000 GB hours per month. Oracle's billing docs say your card is authorized for $100 USD, or the local equivalent, when you upgrade, and the upgrade can take a day or two. Oracle's Always Free page lists upgrading as one option, but no Oracle page quoted here says a paid account gets A1 capacity at once. Keep the retry script running either way.
How often should an Out of host capacity retry script call the Oracle API?
For throttled (429) requests, Oracle recommends exponential backoff from a few seconds up to 60 seconds. A capacity shortage is different, because it can last days. The script in this guide runs at most every five minutes and doubles its wait after each failed pass, up to 30 minutes. That spacing is a choice made here, not an Oracle number. Pass --no-retry, so the CLI does not add its own hidden retries on top.