{"record":{"id":"34708d188d93b66a","repo":"tonhowtf/omniget","slug":"powershell","errorCode":null,"errorMessage":"PowerShell: {}","messagePattern":"PowerShell: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/win_apps.rs","lineNumber":182,"sourceCode":"        .iter()\n        .find(|(prefix, _)| name.starts_with(prefix))\n        .map(|(_, label)| *label)\n}\n\nasync fn powershell(script: &str) -> anyhow::Result<String> {\n    let o = crate::core::process::command(\"powershell\")\n        .args([\n            \"-NoProfile\",\n            \"-NonInteractive\",\n            \"-ExecutionPolicy\",\n            \"Bypass\",\n            \"-Command\",\n            script,\n        ])\n        .output()\n        .await?;\n    if !o.status.success() {\n        return Err(anyhow!(\n            \"PowerShell: {}\",\n            String::from_utf8_lossy(&o.stderr).trim()\n        ));\n    }\n    Ok(String::from_utf8_lossy(&o.stdout).to_string())\n}\n\npub async fn list() -> anyhow::Result<Vec<AppxPackage>> {\n    if !cfg!(target_os = \"windows\") {\n        return Ok(vec![]);\n    }\n    let out = powershell(\"Get-AppxPackage | Where-Object { -not $_.IsFramework -and -not $_.IsResourcePackage } | Select-Object Name,PackageFullName,Version,Publisher,NonRemovable | ConvertTo-Json -Compress\").await?;\n    let json: serde_json::Value =\n        serde_json::from_str(out.trim()).unwrap_or(serde_json::Value::Null);\n    let items: Vec<serde_json::Value> = match json {\n        serde_json::Value::Array(a) => a,\n        serde_json::Value::Object(_) => vec![json],\n        _ => vec![],","sourceCodeStart":164,"sourceCodeEnd":200,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/win_apps.rs#L164-L200","documentation":"A PowerShell invocation launched with -NoProfile -NonInteractive -ExecutionPolicy Bypass exited with a non-zero status; the {} is PowerShell's trimmed stderr. It is the single failure path for every shell script used by list, remove, and restore, so the failing script determines the real cause (bad cmdlet output, missing app entry, execution policy overrides).","triggerScenarios":"Thrown at src-tauri/omniget-core/src/core/tools/win_apps.rs:182 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the PowerShell stderr in the message to see which part of the script failed","Run the same script manually in PowerShell to reproduce and diagnose","Ensure PowerShell is available and not blocked by group policy or antivirus"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}