{"record":{"id":"1b2c8f2fbc2fcecb","repo":"denoland/deno","slug":"unknown-compress-format-other-use-xz-or-zst","errorCode":null,"errorMessage":"unknown --compress format '{other}' (use xz or zstd)","messagePattern":"unknown --compress format '(.+?)' \\(use xz or zstd\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/tools/desktop.rs","lineNumber":933,"sourceCode":"\n  let out = std::fs::File::create(dest_file).with_context(|| {\n    format!(\"failed to create payload {}\", dest_file.display())\n  })?;\n  let out = std::io::BufWriter::new(out);\n  match format {\n    \"xz\" | \"lzma\" => {\n      // Preset 9 ≈ `xz -9`; PRESET_EXTREME trades a lot of CPU for a few\n      // percent, so stick to plain 9 for build-time sanity.\n      let mut enc = liblzma::write::XzEncoder::new(out, 9);\n      enc.write_all(&tar_buf)?;\n      enc.finish()?.flush()?;\n    }\n    \"zstd\" => {\n      let mut enc = zstd::stream::write::Encoder::new(out, 19)?;\n      enc.write_all(&tar_buf)?;\n      enc.finish()?.flush()?;\n    }\n    other => bail!(\"unknown --compress format '{other}' (use xz or zstd)\"),\n  }\n  let comp_len = std::fs::metadata(dest_file).map(|m| m.len()).unwrap_or(0);\n  Ok((raw_len, comp_len))\n}\n\n/// Short, stable cache key derived from the payload bytes — bumps the\n/// extraction directory whenever the app contents change.\nfn payload_hash(payload: &Path) -> Result<String, AnyError> {\n  let bytes = std::fs::read(payload)?;\n  let digest = sha2::Sha256::digest(&bytes);\n  Ok(faster_hex::hex_string(&digest)[..16].to_string())\n}\n\nfn payload_ext(format: &str) -> &'static str {\n  match format {\n    \"zstd\" => \"tar.zst\",\n    _ => \"tar.xz\",\n  }","sourceCodeStart":915,"sourceCodeEnd":951,"githubUrl":"https://github.com/denoland/deno/blob/f7822238cab635a3a19f99f493f675fa81a7f9d8/cli/tools/desktop.rs#L915-L951","documentation":"Thrown by the self-extracting bundle compression step in `deno desktop` when the `--compress <format>` value matches neither the xz branch (\"xz\"/\"lzma\", liblzma preset 9) nor the zstd branch (\"zstd\", level 19). The match is exact and case-sensitive, so any other string — including common archive names or case variants — bails with this message.","triggerScenarios":"`deno desktop compile --compress gzip`, `--compress 7z`, `--compress tar.gz`, `--compress zip`, `--compress XZ` (uppercase), or a typo like `--compress zst` (the accepted spelling is `zstd`).","commonSituations":"Muscle memory from other tools where `--compress gzip` or `--compression 9` is valid; assuming `zst` is the flag spelling because that is the file extension; a config file carrying a compress value copied from a tar/docker command; uppercase spelling from env-var conventions.","solutions":["Use exactly `xz` or `zstd`, lowercase: `--compress xz` (smallest) or `--compress zstd` (faster).","If you typed `zst`, `gzip`, or `lzma`-adjacent names, correct to `xz` (lzma is accepted as an alias) or `zstd`.","Omit `--compress` entirely to keep the tool's default behavior."],"exampleFix":"# before\ndeno desktop compile --compress gzip main.ts\n\n# after\ndeno desktop compile --compress zstd main.ts","handlingStrategy":"validation","validationCode":"# bash: pin the value to the supported set\nCOMPRESS=\"${COMPRESS:-zstd}\"\ncase \"$COMPRESS\" in xz|lzma|zstd) ;; *) echo \"--compress must be xz or zstd\" >&2; exit 1;; esac\ndeno desktop compile --compress \"$COMPRESS\" main.ts","typeGuard":"// TypeScript\nfunction isSupportedCompressFormat(v: string): v is \"xz\" | \"lzma\" | \"zstd\" {\n  return v === \"xz\" || v === \"lzma\" || v === \"zstd\";\n}","tryCatchPattern":null,"preventionTips":["Remember the accepted set is exactly {xz, lzma, zstd}, lowercase.","There is no gzip/zip/7z support; if you need gzip-like compatibility, pick xz.","Define the value once in CI variables and case-guard it before passing to the CLI."],"tags":["desktop","cli","compression","flag-value","validation"],"backgroundTag":"unsupported-cli-flag-value","analyzedSha":"f7822238cab635a3a19f99f493f675fa81a7f9d8","analyzedAt":"2026-08-20T13:07:44.778Z","contentChangedAt":"2026-08-20T13:07:44.778Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}