{"record":{"id":"bf22dce70dd13672","repo":"nikivdev/code","slug":"failed","errorCode":null,"errorMessage":"{} failed","messagePattern":"(.+?) failed","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/docs.rs","lineNumber":676,"sourceCode":"            .with_context(|| format!(\"failed to switch to {}\", path.display()))?;\n        Ok(Self { previous })\n    }\n}\n\nimpl Drop for DirGuard {\n    fn drop(&mut self) {\n        let _ = std::env::set_current_dir(&self.previous);\n    }\n}\n\nfn run_command(cmd: &str, args: &[&str], cwd: &Path) -> Result<()> {\n    let status = Command::new(cmd)\n        .args(args)\n        .current_dir(cwd)\n        .status()\n        .with_context(|| format!(\"failed to run {}\", cmd))?;\n    if !status.success() {\n        bail!(\"{} failed\", cmd);\n    }\n    Ok(())\n}\n\nfn attach_pages_domain(hub_root: &Path, project: &str, domain: &str) -> Result<()> {\n    println!(\"Attaching custom domain {domain} to {project}...\");\n    let mut cmd = if which(\"bun\").is_ok() {\n        let mut cmd = Command::new(\"bun\");\n        cmd.args([\"x\", \"wrangler\", \"pages\", \"domain\", \"add\", project, domain]);\n        cmd\n    } else if which(\"npx\").is_ok() {\n        let mut cmd = Command::new(\"npx\");\n        cmd.args([\"wrangler\", \"pages\", \"domain\", \"add\", project, domain]);\n        cmd\n    } else if which(\"npm\").is_ok() {\n        let mut cmd = Command::new(\"npm\");\n        cmd.args([\n            \"exec\", \"wrangler\", \"--\", \"pages\", \"domain\", \"add\", project, domain,","sourceCodeStart":658,"sourceCodeEnd":694,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/docs.rs#L658-L694","documentation":"run_command executes an external command (used by ensure_docs_hub_deps for `bun install` / `npm install`) and bails with \"<cmd> failed\" when the command runs but exits non-zero. The message intentionally echoes only the program name; the real diagnostics were printed by the child to its own stderr.","triggerScenarios":"`bun install` or `npm install` exits non-zero in the hub root: network failure reaching the registry, package-lock/lockfile mismatch, unsupported engine version, corrupted cache, or out-of-disk during install.","commonSituations":"Offline or proxied environments blocking registry.npmjs.org or bun's registry; lockfile generated by a newer npm/bun; private packages requiring an auth token; Node engines mismatch (e.g. package requires Node >=20).","solutions":["Re-run the install manually in the hub root (cd <hub_root> && bun install / npm install) to see the full child error output","Check network/proxy access to the package registry; configure HTTPS_PROXY or registry mirrors if blocked","Delete node_modules and the lockfile (or refresh the lockfile with the installed package manager version) and reinstall","Verify the Node/bun version satisfies the hub's engines requirement and upgrade if needed"],"exampleFix":"// before\n$ mytool docs hub\nError: bun failed\n// after (diagnose directly)\n$ cd ~/.config/flow/docs-hub && bun install\nerror: lockfile had changes, but lockfile is frozen\n$ rm -rf node_modules bun.lock && bun install\n$ mytool docs hub","handlingStrategy":"try-catch","validationCode":"// check registry reachability before install\nfn registry_ok() -> bool {\n    std::net::TcpStream::connect(\"registry.npmjs.org:443\").is_ok()\n}\nif !registry_ok() {\n    eprintln!(\"package registry unreachable; check network/proxy before installing\");\n    return;\n}","typeGuard":null,"tryCatchPattern":"match run_docs_hub(&opts) {\n    Err(e) if e.to_string().ends_with(\"failed\") && e.to_string().contains(\"bun\") => {\n        eprintln!(\"bun install failed; re-run manually in hub root for full error output\");\n        let _ = std::process::Command::new(\"bun\").arg(\"install\").current_dir(&hub_root).status();\n    }\n    Err(e) => return Err(e),\n    Ok(()) => {}\n}","preventionTips":["Run installs manually once to surface hidden registry/auth errors before automation","Keep lockfiles in sync with the installed package manager version","Configure HTTPS_PROXY/registry mirrors in restricted networks","Monitor disk space on hosts running frequent installs"],"tags":["rust","subprocess","install-failure","npm","bun"],"backgroundTag":"command-exited-nonzero","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}