tonhowtf/omniget · error
reg export falhou
Error message
reg export falhou: {} What it means
The `reg export` command that dumps the key to a timestamped .reg file under registry-backups exited non-zero; the {} is reg.exe's stderr. Usually the key does not exist, is not exportable due to permissions, or the backup directory/file could not be written.
Solutions
- Confirm the registry key actually exists before attempting a backup/fix
- Run the app as administrator for keys under HKEY_LOCAL_MACHINE
- Check that the registry-backups folder under the app data dir is writable
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at src-tauri/omniget-core/src/core/tools/win_registry.rs:164 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12).
Data as JSON: /api/errors/ec6d9419dc5922ff.
Report an issue: GitHub.
Appendix: source
Thrown at src-tauri/omniget-core/src/core/tools/win_registry.rs:164
std::fs::create_dir_all(&dir)?;
let safe: String = key
.chars()
.map(|c| if c.is_ascii_alphanumeric() { c } else { '_' })
.collect();
let file = dir.join(format!(
"{}-{}.reg",
chrono::Local::now().format("%Y%m%d-%H%M%S"),
safe.chars().take(80).collect::<String>()
));
let o = crate::core::process::command("reg")
.arg("export")
.arg(key)
.arg(&file)
.arg("/y")
.output()
.await?;
if !o.status.success() {
return Err(anyhow!(
"reg export falhou: {}",
String::from_utf8_lossy(&o.stderr).trim()
));
}
Ok(file)
}
/// Expande `%VAR%` e devolve o executável de uma linha de comando do registro
/// (`"C:\x\a.exe" /arg`, `C:\x\a.exe /arg`, `rundll32 ...`).
pub fn command_exe(cmd: &str) -> Option<PathBuf> {
let s = expand_env(cmd.trim());
if s.is_empty() {
return None;
}
let candidate = if let Some(rest) = s.strip_prefix('"') {
rest.split('"').next().unwrap_or("").to_string()
} else {
// sem aspas: até o primeiro ".exe" (com espaços no caminho) ou o primeiro tokenView on GitHub (pinned to 8600b91f42)