diegosouzapw/OmniRoute · error · SafeOutboundFetchError
INVALID_URL
INVALID_URL
Error message
Invalid outbound URL: ${String(input)} What it means
SafeOutboundFetchError wrapping a URL that failed validation before any request was made. normalizeUrl() maps OutboundUrlGuardError from parseOutboundUrl (invalid or policy-blocked URL) into code INVALID_URL/URL_GUARD_BLOCKED, and constructs this same message for any other invalid input. Not retryable.
Solutions
- Correct the URL string passed to safeFetch — ensure it parses and uses http/https
- Remove embedded userinfo credentials from the URL
- If blocked by policy (private host), adjust the outbound URL guard opt-ins or use a public endpoint
- Inspect error.code to distinguish parse failure (INVALID_URL) from policy block (URL_GUARD_BLOCKED)
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at src/shared/network/safeOutboundFetch.ts:161 when the library encounters an invalid state.
Common situations: See trigger scenarios.
Understand the failure class
Background: "Invalid URL" / "URL cannot be empty": fix the malformed or missing URL behind request-construction failures — this error's family across 50 libraries.
AI-assisted analysis of diegosouzapw/OmniRoute@a179ffed5b (2026-08-25).
Data as JSON: /api/errors/306979f18531382a.
Report an issue: GitHub.
Appendix: source
Thrown at src/shared/network/safeOutboundFetch.ts:161
function normalizeMethod(method?: string) {
return (method || "GET").toUpperCase();
}
function normalizeUrl(input: string | URL) {
try {
return parseOutboundUrl(input);
} catch (error) {
if (error instanceof OutboundUrlGuardError) {
throw new SafeOutboundFetchError(error.message, {
code: error.code === "OUTBOUND_URL_INVALID" ? "INVALID_URL" : "URL_GUARD_BLOCKED",
url: error.url,
method: "GET",
attempts: 1,
isRetryable: false,
cause: error,
});
}
throw new SafeOutboundFetchError(`Invalid outbound URL: ${String(input)}`, {
code: "INVALID_URL",
url: String(input),
method: "GET",
attempts: 1,
isRetryable: false,
cause: error,
});
}
}
function applyUrlGuard(targetUrl: URL, guard: SafeOutboundFetchGuard, method: string) {
if (guard === "none") return;
try {
// "public-only" rejects every private host; "block-metadata" (#5066) allows private/LAN
// hosts but still rejects cloud-metadata / link-local endpoints.
if (guard === "block-metadata") {
parseAndValidateNonMetadataUrl(targetUrl);View on GitHub (pinned to a179ffed5b)