musistudio/claude-code-router · error · Error

Provider manifest URL is invalid.

Error message

Provider manifest URL is invalid.

What it means

The final manifest URL check requires a hostname: an https URL like "https:///m.json" parses successfully but has an empty host, so the manifest cannot be fetched and the URL is declared invalid.

Source

Thrown at packages/core/src/contracts/deep-link.ts:487

  const url = new URL(providerUrlWithDefaultScheme(value));
  if (!["http:", "https:"].includes(url.protocol)) {
    throw new Error("Provider Base URL must use http or https.");
  }
  if (!url.hostname) {
    throw new Error("Provider Base URL is invalid.");
  }
}

function validateManifestUrl(value: string): void {
  const url = new URL(value);
  if (url.protocol !== "https:") {
    throw new Error("Provider manifest URL must use https.");
  }
  if (url.username || url.password) {
    throw new Error("Provider manifest URL cannot include credentials.");
  }
  if (!url.hostname) {
    throw new Error("Provider manifest URL is invalid.");
  }
}

function normalizeProviderProtocol(value: string | undefined): GatewayProviderProtocol | undefined {
  if (!value) {
    return undefined;
  }
  const protocol = value.trim();
  if (!providerProtocols.has(protocol as GatewayProviderProtocol)) {
    throw new Error(`Unsupported provider protocol: ${value}`);
  }
  return protocol as GatewayProviderProtocol;
}

function readDeepLinkModels(params: URLSearchParams, payload: Record<string, unknown> | undefined): string[] {
  const values = [
    ...params.getAll("models"),
    ...payloadModels(payload)

View on GitHub (pinned to 99f24806c6)

Solutions

  1. Include the full host: https://cdn.example.com/provider/manifest.json
  2. Assert the composed URL has a hostname before embedding it in links
  3. Set missing env/config values used to build the manifest URL

Example fix

// before
manifest=https%3A%2F%2F%2Fprovider.json
// after
manifest=https%3A%2F%2Fcdn.example.com%2Fprovider.json
Defensive patterns

Strategy: validation

Validate before calling

if (!new URL(manifestUrl).hostname) return reject("manifest URL missing host");

Type guard

const manifestUrlHasHost = (u: string) => { try { return new URL(u).hostname.length > 0; } catch { return false; } };

Try / catch

try { parseProviderManifestDeepLinkPayload(url); } catch (e) { if (e instanceof Error && e.message === "Provider manifest URL is invalid.") return askForManifestUrl(); throw e; }

Prevention

When it happens

Trigger: A manifest param whose URL has no hostname, e.g. https:///provider.json or https://:8443/m.json.

Common situations: Link generators interpolating an unset host variable; truncated copy-paste losing the domain; malformed template output.

Related errors


AI-assisted analysis of musistudio/claude-code-router@99f24806c6 (2026-08-27). Data as JSON: /api/errors/6573ec1a63b92c8d. Report an issue: GitHub.