{"record":{"id":"495482a3061b0c76","repo":"wasmerio/wasmer","slug":"cannot-create-app-from-template-in-offline-mode","errorCode":null,"errorMessage":"Cannot create app from template in offline mode","messagePattern":"Cannot create app from template in offline mode","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"lib/cli/src/commands/app/create.rs","lineNumber":653,"sourceCode":"            let mut path_root_dir = PathBuf::from(root_dir);\n            if path_root_dir.is_absolute() {\n                path_root_dir = path_root_dir.strip_prefix(\"/\")?.to_path_buf();\n            }\n            return Ok((url, Some(path_root_dir)));\n        }\n\n        Ok((url, None))\n    }\n\n    async fn create_from_template(\n        &self,\n        client: Option<&WasmerClient>,\n        owner: &str,\n        app_name: &str,\n    ) -> anyhow::Result<bool> {\n        let client = match client {\n            Some(client) => client,\n            None => anyhow::bail!(\"Cannot create app from template in offline mode\"),\n        };\n\n        let (url, mut root_dir) = self.get_template_url(client).await?;\n        root_dir = root_dir.map(|v| v.clean());\n        let root_dir_str = if let Some(ref root_dir) = root_dir {\n            root_dir.display().to_string()\n        } else {\n            \"./\".to_string()\n        };\n        tracing::info!(\"Downloading template from url {url}, using root dir {root_dir_str}\");\n\n        let output_path = self.get_output_dir(app_name).await?;\n        let pb = indicatif::ProgressBar::new_spinner();\n\n        pb.enable_steady_tick(std::time::Duration::from_millis(500));\n        pb.set_style(\n            indicatif::ProgressStyle::with_template(\"{spinner:.magenta} {msg}\")\n                .unwrap()","sourceCodeStart":635,"sourceCodeEnd":671,"githubUrl":"https://github.com/wasmerio/wasmer/blob/8c4b9ee9d33fb2068863fbb3d328683e7e6ff7f5/lib/cli/src/commands/app/create.rs#L635-L671","documentation":"create_from_template requires a WasmerClient because templates are fetched from the registry. When the client is None (offline mode / not connected), it bails with 'Cannot create app from template in offline mode'. The library throws it since remote template download is impossible without a connection.","triggerScenarios":"Running `wasmer app create --template <slug>` while offline (--offline flag, no network, or no registry client could be constructed), so run_async passes client: None into create_from_template.","commonSituations":"Air-gapped/CI environments using --offline; network outage or blocked registry host; unauthenticated setups where client resolution failed.","solutions":["Remove the --offline flag and ensure network access to the registry so a client can be created.","Log in / fix registry configuration (WASMER_REGISTRY, tokens) so a WasmerClient is available.","Pre-scaffold locally (e.g. --use-local-manifest or a checked-in template) instead of fetching a template while offline."],"exampleFix":"// before\n// wasmer app create --offline --template wasmer/hello-world\n// after\n// wasmer app create --template wasmer/hello-world","handlingStrategy":"validation","validationCode":"if (args.offline && args.template) {\n  throw new Error('cannot fetch a registry template in offline mode');\n}","typeGuard":"fn can_fetch_templates(client: &Option<WasmerClient>) -> bool {\n    client.is_some()\n}","tryCatchPattern":"match result {\n    Err(e) if e.to_string().contains(\"offline mode\") => {\n        eprintln!(\"retry with network access or use a local manifest\");\n        // fall back to --use-local-manifest flow\n    }\n    other => other?,\n}","preventionTips":["Never combine --offline with --template.","Check network/registry connectivity and login before template-based creates.","Keep a local template/manifest path for air-gapped environments."],"tags":["wasmer","cli","offline","network","app-create"],"backgroundTag":"offline-mode-operation","analyzedSha":"8c4b9ee9d33fb2068863fbb3d328683e7e6ff7f5","analyzedAt":"2026-09-01T23:06:31.009Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}