{"record":{"id":"bab5ce0e608dd648","repo":"nikivdev/code","slug":"jazz2-app-create-failed","errorCode":null,"errorMessage":"jazz2 app create failed: {}{}","messagePattern":"jazz2 app create failed: (.+?)(.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/storage.rs","lineNumber":355,"sourceCode":"        let package_spec = jazz_tools_package_spec();\n        println!(\n            \"Running: npx --yes {} create app --name {}\",\n            package_spec, name\n        );\n        {\n            let mut cmd = Command::new(\"npx\");\n            cmd.args([\"--yes\"]);\n            cmd.arg(&package_spec);\n            cmd.args([\"create\", \"app\", \"--name\", name]);\n            run_command_with_output(cmd)\n        }\n        .context(\"failed to spawn npx\")?\n    };\n\n    if !output.status.success() {\n        let stdout = String::from_utf8_lossy(&output.stdout);\n        let stderr = String::from_utf8_lossy(&output.stderr);\n        bail!(\n            \"jazz2 app create failed: {}{}\",\n            stdout.trim(),\n            stderr.trim()\n        );\n    }\n\n    let stdout = String::from_utf8_lossy(&output.stdout);\n    let app_id = stdout\n        .lines()\n        .rev()\n        .find(|line| !line.trim().is_empty())\n        .map(|line| line.trim().to_string())\n        .ok_or_else(|| anyhow::anyhow!(\"jazz-tools did not return an app id\"))?;\n\n    Ok(JazzAppCredentials {\n        app_id,\n        backend_secret: generate_secret(\"backend\"),\n        admin_secret: generate_secret(\"admin\"),","sourceCodeStart":337,"sourceCodeEnd":373,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/storage.rs#L337-L373","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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."],"exampleFix":"// before\nmyapp jazz new app --name my-app\n// jazz2 app create failed: Not authenticated...\n// after\nexport JAZZ_API_KEY=...  # or run jazz2 login first\nmyapp jazz new app --name my-app","handlingStrategy":"try-catch","validationCode":"if (!process.env.JAZZ_API_KEY && !process.env.JAZZ_AUTH_TOKEN) {\n  throw new Error('Jazz credentials missing; authenticate before creating an app.');\n}\nconst ver = cp.execSync('npx --yes jazz2 --version').toString().trim();\nconsole.log(`jazz2 version: ${ver}`); // confirm CLI availability up front","typeGuard":null,"tryCatchPattern":"try {\n  await jazzNew({ kind: 'cloudflare', name });\n} catch (e) {\n  const msg = String(e);\n  if (msg.includes('jazz2 app create failed')) {\n    console.error('jazz2 provisioning failed. Check auth/network, inspect detail below:');\n    console.error(msg); // stdout/stderr detail is appended\n    return;\n  }\n  throw e;\n}","preventionTips":["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."],"tags":["process","npx","jazz","provisioning","authentication"],"backgroundTag":"provisioning-cli-failed","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}