{"record":{"id":"a5c7c5764b2212e9","repo":"denoland/deno","slug":"installation-rejected","errorCode":null,"errorMessage":"Installation rejected","messagePattern":"Installation rejected","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"cli/tools/x.rs","lineNumber":910,"sourceCode":"    XTempDir::New(temp_dir) => {\n      let confirmed = yes\n        || match confirm(ConfirmOptions {\n          default: true,\n          message: format!(\"Install {}?\", req_ref),\n        }) {\n          Some(true) => true,\n          Some(false) => false,\n          None if !DrawThread::is_supported() => {\n            log::warn!(\n              \"Unable to prompt, installing {} without confirmation\",\n              req_ref.req()\n            );\n            true\n          }\n          None => false,\n        };\n      if !confirmed {\n        return Err(anyhow::anyhow!(\"Installation rejected\"));\n      }\n      match req_ref {\n        ReqRef::Npm(req_ref) => {\n          let pkg_json = temp_dir.join(\"package.json\");\n          std::fs::write(\n            &pkg_json,\n            format!(\n              \"{{\\\"dependencies\\\": {{\\\"{}\\\": \\\"{}\\\"}} }}\",\n              req_ref.req().name,\n              req_ref.req().version_req\n            ),\n          )?;\n        }\n        ReqRef::Jsr(req_ref) => {\n          let deno_json = temp_dir.join(\"deno.json\");\n          let mut imports = serde_json::Map::new();\n          imports.insert(\n            req_ref.req().name.to_string(),","sourceCodeStart":892,"sourceCodeEnd":928,"githubUrl":"https://github.com/denoland/deno/blob/9ad36f7a2cce60488e6ec52283efb32efddaf93a/cli/tools/x.rs#L892-L928","documentation":"The first time `deno x <pkg>` runs, it creates a temp install project and prompts \"Install <pkg>?\" (default yes, x.rs:892-908). Only an explicit decline — or a prompt that ends with no answer while the drawing thread is supported (e.g. immediate EOF) — aborts with \"Installation rejected\". Note the asymmetry at x.rs:900-906: when the terminal cannot draw prompts at all, Deno warns and installs anyway.","triggerScenarios":"Answering `n` to the install confirmation; piping/redirecting stdin so the prompt reads EOF; scripts calling deno x without -y in an environment that can render prompts but receives no input.","commonSituations":"Interactive sessions where the user changes their mind; CI jobs with a TTY emulator and closed stdin; wrappers that capture stdin for logging.","solutions":["Re-run `deno x <pkg>` and confirm with Enter (yes is the default).","Skip the prompt entirely: `deno x -y <pkg>`.","For unattended use, pre-install once with `deno install -g <pkg>` so x never needs to prompt again."],"exampleFix":"# before\n$ deno x some-tool </dev/null\n? Install some-tool? … error: Installation rejected\n\n# after\ndeno x -y some-tool","handlingStrategy":"retry","validationCode":"# Pre-install so deno x never needs the confirmation prompt\ndeno install -g <pkg> >/dev/null 2>&1\ndeno x <pkg>","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pass -y/--yes to deno x in every script and CI job.","Pre-install packages with deno install -g for unattended environments.","Keep stdin usable (or closed with -y) when wrapping deno x in harnesses that capture input."],"tags":["deno-x","install","prompt","cli"],"backgroundTag":"install-confirmation-declined","analyzedSha":"9ad36f7a2cce60488e6ec52283efb32efddaf93a","analyzedAt":"2026-08-20T13:07:44.778Z","contentChangedAt":"2026-08-20T13:07:44.778Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}