wasmerio/wasmer · error · anyhow::Error

Template ' ' not found in the registry

Error message

Template '{template}' not found in the registry

What it means

get_template_url resolves an app template by slug through the registry (fetch_app_template_from_slug). When a template name was provided but the registry has no matching slug, it bails. The library throws it because the requested template simply does not exist remotely.

Solutions

  1. Check the exact template slug against the registry (browse available templates) and correct the --template value.
  2. Verify you are using the intended registry (registry flag/env) where the template exists.
  3. Omit --template and pick interactively, or use --use-local-manifest for a local app.

Example fix

// before
// wasmer app create --template wasmer/hello-word   (typo)
// after
// wasmer app create --template wasmer/hello-world
Defensive patterns

Strategy: validation

Validate before calling

// verify the slug exists before using it
const tpl = await registry.fetchAppTemplateFromSlug(slug);
if (!tpl) throw new Error(`template ${slug} not found in registry`);

Type guard

fn template_exists(t: &Option<AppTemplate>) -> bool {
    t.is_some()
}

Try / catch

match result {
    Err(e) if e.to_string().contains("not found in the registry") => {
        eprintln!("listing available templates...");
        // fetch and show template list, then retry with a valid slug
    }
    other => other?,
}

Prevention

When it happens

Trigger: Running `wasmer app create --template <slug>` where <slug> is not found via fetch_app_template_from_slug on the configured registry.

Common situations: Typo in the template slug; template removed/renamed upstream; pointing at a registry (custom --registry) that does not host the template.

Related errors


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

Appendix: source

Thrown at lib/cli/src/commands/app/create.rs:536

    }

    // A utility function used to fetch the URL of the template to use.
    async fn get_template_url(
        &self,
        client: &WasmerClient,
    ) -> anyhow::Result<(url::Url, Option<PathBuf>)> {
        let (mut url, selected_template): (url::Url, Option<AppTemplate>) = if let Some(template) =
            &self.template
        {
            if let Ok(url) = url::Url::parse(template) {
                (url, None)
            } else if let Some(template) =
                wasmer_backend_api::query::fetch_app_template_from_slug(client, template.clone())
                    .await?
            {
                (url::Url::parse(&template.repo_url)?, Some(template))
            } else {
                anyhow::bail!("Template '{template}' not found in the registry")
            }
        } else {
            if self.non_interactive {
                anyhow::bail!("No template selected")
            }

            let theme = ColorfulTheme::default();
            let registry = self
                .env
                .registry_public_url()?
                .host_str()
                .unwrap_or("unknown_registry")
                .replace('.', "_");
            let cache_dir = self.env.cache_dir().join("templates").join(registry);

            let languages = Self::fetch_template_languages_cached(client, &cache_dir).await?;

            let items = languages.iter().map(|t| t.name.clone()).collect::<Vec<_>>();

View on GitHub (pinned to 8c4b9ee9d3)