Apps Script: Exception: Address unavailable
Last verified
Exception: Address unavailable: https://example.com/apiWhat it means
UrlFetchApp.fetch throws this when it could not get any HTTP response from the target at all. Unlike Request failed ... returned code, there is no status code, because no server answered the request.
Google does not document this message on its reference pages, but developer reports are consistent: it usually means the destination refused or dropped the connection from the Google IP address the request came from, or could not be reached from Google's network. It is often intermittent, because Apps Script requests leave from a pool of Google addresses and only some may be blocked.
Since there is no response, muteHttpExceptions does not suppress it. Only a try...catch lets your script continue.
What it looks like
let res;
for (let i = 0; i < 3; i++) {
try { res = UrlFetchApp.fetch(url); break; }
catch (e) { console.log(e.message); Utilities.sleep(2000 * (i + 1)); }
}Why it happens
- The target server or its firewall blocks some or all of Google's IP ranges.
- The host is a private, internal or localhost address that is not reachable from the internet.
- DNS for the hostname does not resolve, or resolves to an unreachable address.
- The server is down or overloaded and drops connections.
- Repeated rapid requests trigger the target's connection-level protection.
How to fix it
- Confirm the URL is publicly reachable from outside your network, for example from a phone on mobile data.
- Wrap the fetch in try...catch and retry a few times with increasing waits; many cases succeed on retry.
- If you control the server, allow Google's published IP ranges in its firewall.
- If the endpoint is internal, expose it through a public, authenticated gateway instead of calling a private address.
- Slow down the request rate if failures cluster during bursts.
How to stop it recurring
Only call endpoints designed for server-to-server access. Build retries into a shared fetch helper and log the failures so you can tell an intermittent block from a hard outage. If the provider supports it, ask them to allow Google's IP ranges for your integration.
Official documentation: developers.google.com/apps-script/reference/url-fetch/url-fetch-app. See all Apps Script error messages or the Apps Script limits and quotas.
Related errors
Definitions
- Google Apps ScriptGoogle Apps Script is Google's cloud-hosted JavaScript platform for automating Google Workspace: Sheets, Gmail
- Error HandlingError handling is the practice of anticipating, detecting, and responding to errors in software execution, inc
- Rate LimitingRate limiting is a technique that controls the number of requests a client can make to a server within a given
- OAuth 2.0OAuth 2.0 is the IETF authorization standard (RFC 6749) that lets an app access your account in another servic
Quick answers
What does "Exception: Address unavailable" mean in Apps Script?
UrlFetchApp.fetch throws this when it could not get any HTTP response from the target at all. Unlike Request failed ... returned code , there is no status code, because no server answered the request.
How do I fix "Exception: Address unavailable"?
1. Confirm the URL is publicly reachable from outside your network, for example from a phone on mobile data. 2. Wrap the fetch in try...catch and retry a few times with increasing waits; many cases succeed on retry. 3. If you control the server, allow Google's published IP ranges in its firewall. 4. If the endpoint is internal, expose it through a public, authenticated gateway instead of calling a private address. 5. Slow down the request rate if failures cluster during bursts.
Run the job somewhere with its own limits
If a script keeps hitting its host's quotas, an Autonoly workflow can run the same steps on a schedule in an isolated cloud container, and the AI agent has a terminal with Python for steps that need code. Autonoly has limits of its own, priced in credits.
Also see Agent terminal & SSH.