{"record":{"id":"91a6c2c1aca6c609","repo":"tonhowtf/omniget","slug":"kdeconnect-cli-falhou","errorCode":null,"errorMessage":"kdeconnect-cli falhou: {}","messagePattern":"kdeconnect-cli falhou: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/kdeconnect.rs","lineNumber":103,"sourceCode":"        .unwrap_or_default();\n    KdeStatus {\n        installed: true,\n        path: Some(bin.to_string_lossy().to_string()),\n        devices,\n        install_hint: hint,\n    }\n}\n\nasync fn run(args: &[&str]) -> anyhow::Result<String> {\n    let bin = locate()\n        .await\n        .ok_or_else(|| anyhow!(\"kdeconnect-cli nao encontrado\"))?;\n    let out = crate::core::process::command(&bin)\n        .args(args)\n        .output()\n        .await?;\n    if !out.status.success() {\n        return Err(anyhow!(\n            \"kdeconnect-cli falhou: {}\",\n            String::from_utf8_lossy(&out.stderr).trim()\n        ));\n    }\n    Ok(String::from_utf8_lossy(&out.stdout).trim().to_string())\n}\n\npub async fn share_file(device: &str, path: &str) -> anyhow::Result<String> {\n    run(&[\"-d\", device, \"--share\", path]).await\n}\n\npub async fn share_url(device: &str, url: &str) -> anyhow::Result<String> {\n    run(&[\"-d\", device, \"--share\", url]).await\n}\n\npub async fn share_text(device: &str, text: &str) -> anyhow::Result<String> {\n    run(&[\"-d\", device, \"--share-text\", text]).await\n}","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/kdeconnect.rs#L85-L121","documentation":"After run() successfully locates and spawns kdeconnect-cli with the given args, it checks the child process exit status. A non-zero exit makes the library surface kdeconnect-cli's stderr (trimmed) as an anyhow error, so the underlying CLI failure message is preserved for the caller.","triggerScenarios":"Any share_file/share_url/share_text/ping/refresh call where the spawned kdeconnect-cli invocation exits non-zero — e.g. no paired device, device offline, wrong device id passed through args, or the KDE Connect daemon not running.","commonSituations":"No devices paired (`kdeconnect-cli --list-devices` empty); remote device unreachable or screen locked; kdeconnectd not running; specifying a device name/id that does not exist; permissions missing to send files to the device.","solutions":["Read the stderr text embedded in the error message — it is the CLI's own diagnostic; fix the condition it reports.","Run `kdeconnect-cli --list-devices` manually to confirm a paired, reachable device exists, and pair with `kdeconnect-cli --pair -d <id>` if needed.","Ensure the KDE Connect daemon is running (`kdeconnectd` or restart the KDE Connect app) and the phone/desktop app is open and on the same network.","Retry the operation once the device is available; the error is deterministic for the current device state, not transient."],"exampleFix":"// before\nkdeconnect.share_file(\"nonexistent-device\", \"/tmp/x.pdf\").await?;\n// kdeconnect-cli falhou: No such device or device not paired\n\n// after\nlet devices = kdeconnect.refresh().await?; // pick a valid paired id\nkdeconnect.share_file(&devices[0].id, \"/tmp/x.pdf\").await?;","handlingStrategy":"try-catch","validationCode":"// ensure a device is paired and reachable first\nlet out = Command::new(\"kdeconnect-cli\").args([\"--list-devices\"]).output()?;\nif String::from_utf8_lossy(&out.stdout).trim().is_empty() {\n    eprintln!(\"no paired KDE Connect device\");\n}","typeGuard":null,"tryCatchPattern":"match kdeconnect.share_text(device, msg).await {\n    Err(e) if e.to_string().starts_with(\"kdeconnect-cli falhou\") => {\n        log::warn!(\"kdeconnect-cli stderr: {}\", e);\n        prompt_user_to_pair_device();\n    }\n    r => r?,\n}","preventionTips":["Call refresh/list first and pick a valid paired device id","Ensure kdeconnectd is running in your session","Surface the embedded stderr to the user instead of swallowing it"],"tags":["external-command","cli-failure","kdeconnect","stderr"],"backgroundTag":"git-command-failed","analyzedSha":"8600b91f4246848bac346874daa9e61c1fc5677a","analyzedAt":"2026-09-12T14:29:19.317Z","contentChangedAt":"2026-09-12T14:29:19.317Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}