wasmerio/wasmer · error

could not determine app domain for backend url '{domain}': u

Error message

could not determine app domain for backend url '{domain}': unknown backend

What it means

`WasmerEnv::app_domain` maps a configured backend URL's host to one of Wasmer's known deployment domains (wasmer.io prod, wasmer.wtf dev, wasmer.fun bug tracker). If the backend host matches none of the known suffixes, the method bails because it cannot safely pick which app domain apps should be served from. This guards against pointing the CLI at an unknown or third-party backend.

Source

Thrown at lib/cli/src/config/env.rs:154

            .registry
            .get_login_token_for_registry(registry_endpoint.as_str())
    }

    pub fn app_domain(&self) -> Result<String, Error> {
        let registry_url = self.registry_public_url()?;
        let domain = registry_url
            .host_str()
            .context("url has no host")?
            .trim_end_matches('.');

        if domain.ends_with("wasmer.io") {
            Ok(Self::APP_DOMAIN_PROD.to_string())
        } else if domain.ends_with("wasmer.wtf") {
            Ok(Self::APP_DOMAIN_DEV.to_string())
        } else if domain.ends_with("wasmer.fun") {
            Ok(Self::APP_DOMAIN_BUGT.to_string())
        } else {
            anyhow::bail!(
                "could not determine app domain for backend url '{domain}': unknown backend"
            );
        }
    }

    pub fn client_unauthennticated(&self) -> Result<WasmerClient, anyhow::Error> {
        let registry_url = self.registry_endpoint()?;

        let proxy = self.proxy()?;

        let client = wasmer_backend_api::WasmerClient::new_with_proxy(
            registry_url,
            &DEFAULT_WASMER_CLI_USER_AGENT,
            proxy,
        )?;

        let client = if let Some(token) = self.token() {
            client.with_auth_token(token)

View on GitHub (pinned to 8c4b9ee9d3)

Solutions

  1. Set the backend URL to an official Wasmer domain (registry.wasmer.io, registry.wasmer.wtf, registry.wasmer.fun)
  2. If running a private backend, use a host whose domain ends in one of the supported suffixes or patch/add the suffix in config/env.rs
  3. Fix typos in the WASMER_TOKEN/WASMER_REGISTRY env vars or `wasmer login --registry <url>` argument

Example fix

// before
WASMER_REGISTRY=https://registry.mycompany.internal wasmer deploy
// after
WASMER_REGISTRY=https://registry.wasmer.io wasmer deploy
Defensive patterns

Strategy: validation

Validate before calling

let backend = std::env::var("WASMER_REGISTRY").unwrap_or_default();
let host = url::Url::parse(&backend)?.host_str().unwrap_or("").to_string();
const KNOWN: [&str; 3] = ["wasmer.io", "wasmer.wtf", "wasmer.fun"];
if !KNOWN.iter().any(|d| host.ends_with(d)) {
    anyhow::bail!("backend '{host}' is not a known Wasmer domain");
}

Type guard

fn is_known_wasmer_backend(url: &str) -> bool {
    ["wasmer.io", "wasmer.wtf", "wasmer.fun"]
        .iter()
        .any(|d| url.ends_with(d))
}

Try / catch

match env.app_domain() {
    Ok(domain) => domain,
    Err(e) if e.to_string().contains("unknown backend") => {
        eprintln!("Point WASMER_REGISTRY at an official registry.wasmer.io host");
        return Err(e);
    }
    Err(e) => return Err(e.into()),
}

Prevention

When it happens

Trigger: Any code path calling `env.app_domain()` when the registry/backend URL host does not end with wasmer.io, wasmer.wtf, or wasmer.fun — e.g. WASMER_REGISTRY pointing at a self-hosted registry, localhost, or a typo'd domain.

Common situations: Running against a private/forked registry deployment, local development backends on localhost or a staging host, or a mistyped registry URL in WASMER_REGISTRY/config.

Related errors


AI-assisted analysis of wasmerio/wasmer@8c4b9ee9d3 (2026-09-01). Data as JSON: /api/errors/86ceaed74d04d380. Report an issue: GitHub.