nikivdev/code · error · anyhow::Error
jazz2 app create failed: {}{}
Error message
jazz2 app create failed: {}{} What it means
create_jazz_app_credentials runs `npx jazz2 app create` (via Command::new("npx")) to provision a Jazz app and its credentials. If the process exits non-zero, the captured stdout and stderr are concatenated into this error. It wraps whatever the jazz2 CLI printed about why app creation failed.
Source
Thrown at src/storage.rs:355
let package_spec = jazz_tools_package_spec();
println!(
"Running: npx --yes {} create app --name {}",
package_spec, name
);
{
let mut cmd = Command::new("npx");
cmd.args(["--yes"]);
cmd.arg(&package_spec);
cmd.args(["create", "app", "--name", name]);
run_command_with_output(cmd)
}
.context("failed to spawn npx")?
};
if !output.status.success() {
let stdout = String::from_utf8_lossy(&output.stdout);
let stderr = String::from_utf8_lossy(&output.stderr);
bail!(
"jazz2 app create failed: {}{}",
stdout.trim(),
stderr.trim()
);
}
let stdout = String::from_utf8_lossy(&output.stdout);
let app_id = stdout
.lines()
.rev()
.find(|line| !line.trim().is_empty())
.map(|line| line.trim().to_string())
.ok_or_else(|| anyhow::anyhow!("jazz-tools did not return an app id"))?;
Ok(JazzAppCredentials {
app_id,
backend_secret: generate_secret("backend"),
admin_secret: generate_secret("admin"),View on GitHub (pinned to a747e741ae)
Solutions
- Read the stdout/stderr detail appended to this error and fix the underlying jazz2 failure it reports.
- Authenticate with Jazz (set the required API key / run the jazz2 login flow) before bootstrapping.
- Retry after checking network access to the Jazz API and npm registry (corporate proxies often block these).
- Verify the installed jazz2 version still supports `app create` with the flags this CLI passes; pin or upgrade as needed.
Example fix
// before myapp jazz new app --name my-app // jazz2 app create failed: Not authenticated... // after export JAZZ_API_KEY=... # or run jazz2 login first myapp jazz new app --name my-app
Defensive patterns
Strategy: try-catch
Validate before calling
if (!process.env.JAZZ_API_KEY && !process.env.JAZZ_AUTH_TOKEN) {
throw new Error('Jazz credentials missing; authenticate before creating an app.');
}
const ver = cp.execSync('npx --yes jazz2 --version').toString().trim();
console.log(`jazz2 version: ${ver}`); // confirm CLI availability up front Try / catch
try {
await jazzNew({ kind: 'cloudflare', name });
} catch (e) {
const msg = String(e);
if (msg.includes('jazz2 app create failed')) {
console.error('jazz2 provisioning failed. Check auth/network, inspect detail below:');
console.error(msg); // stdout/stderr detail is appended
return;
}
throw e;
} Prevention
- Authenticate with Jazz before running bootstrap/jazz new commands.
- Verify network access to npm registry and the Jazz API (esp. behind corporate proxies).
- Check for app-name collisions and pick unique names.
- Pin the jazz2 CLI version so flag changes don't break provisioning.
When it happens
Trigger: bootstrap_cloudflare_secrets or jazz_new calling create_jazz_app_credentials when output.status.success() is false — npx ran but jazz2 app create failed (auth missing, network error, name conflict, invalid options).
Common situations: Not logged in to Jazz (no credentials/API key in env); jazz2 package version changed its CLI flags; network/proxy blocking npm registry or Jazz API; app name already taken; Node/npx not installed or wrong version.
Related errors
- editor exited with status {}
- suggested command exited unsuccessfully with status {}
- device auth start failed: HTTP {}
- device auth poll failed: HTTP {}
- device code expired. Run `f auth` again.
AI-assisted analysis of nikivdev/code@a747e741ae (2026-09-01).
Data as JSON: /api/errors/bab5ce0e608dd648.
Report an issue: GitHub.