{"record":{"id":"26f2f3002701e0df","repo":"libnyanpasu/clash-nyanpasu","slug":"reject-is-missing-in-proxies","errorCode":null,"errorMessage":"REJECT is missing in /proxies","messagePattern":"REJECT is missing in /proxies","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"backend/tauri/src/core/clash/proxies.rs","lineNumber":127,"sourceCode":"                    )\n                })\n                .collect()\n        };\n\n        // 2. Map every provider-owned proxy by name. Mihomo 1.19.28 no longer\n        // includes these nodes in /proxies, so their metadata must come from\n        // /providers/proxies.\n        let provider_map = provider_proxy_map(&providers_proxies);\n        let generate_item = |name: &str| resolve_proxy(name, &inner_proxies, &provider_map);\n\n        let global = inner_proxies.get(\"GLOBAL\");\n        let direct = inner_proxies\n            .get(\"DIRECT\")\n            .ok_or(anyhow::anyhow!(\"DIRECT is missing in /proxies\"))?\n            .clone(); // It should be always exists\n        let reject = inner_proxies\n            .get(\"REJECT\")\n            .ok_or(anyhow::anyhow!(\"REJECT is missing in /proxies\"))?\n            .clone(); // It should be always exists\n\n        // 3. generate the proxies groups\n        let groups: Vec<ProxyGroupItem> = match global {\n            Some(api::ProxyItem { all: Some(all), .. }) => {\n                let all = all.clone();\n                all.into_iter()\n                    .filter(|name| {\n                        matches!(\n                            inner_proxies.get(name),\n                            Some(api::ProxyItem { all: Some(_), .. })\n                        )\n                    })\n                    .map(|name| {\n                        let item = inner_proxies\n                            .get(&name)\n                            .unwrap_or(&api::ProxyItem::default())\n                            .clone();","sourceCodeStart":109,"sourceCodeEnd":145,"githubUrl":"https://github.com/libnyanpasu/clash-nyanpasu/blob/f7dbce2997c633e484f54788035e770b3ee99773/backend/tauri/src/core/clash/proxies.rs#L109-L145","documentation":"Thrown by `Proxies::from_responses` when the `/proxies` response from the Clash/Mihomo core lacks the built-in `REJECT` proxy entry. Like `DIRECT`, `REJECT` is assumed to always exist in a well-formed /proxies payload; its absence indicates the response is not a valid proxies map and the constructor fails fast rather than building an incomplete model.","triggerScenarios":"Calling `Proxies::from_responses` where the inner proxies map from `GET /proxies` has no `\"REJECT\"` key — same causes as the missing-DIRECT case: empty/error response, wrong endpoint or port, non-standard core, partial startup.","commonSituations":"Hitting the controller before the core finished initializing; external controller misconfigured (wrong secret/port returning an error body that deserializes into an empty map); custom core builds or middleware stripping built-in entries; API version drift.","solutions":["Confirm the core is fully started and re-fetch /proxies; missing REJECT is usually a not-ready or malformed response.","Curl the external controller's /proxies endpoint and check that \"REJECT\" is present in the JSON.","Verify the external controller address, port and secret are correct so you are not parsing an error body.","Update or replace non-standard cores that omit built-in proxy entries."],"exampleFix":"// before\nlet proxies = Proxies::from_responses(proxies_res, providers_res)?;\n// after\nfor builtin in [\"DIRECT\", \"REJECT\"] {\n    if !proxies_res.proxies.contains_key(builtin) {\n        anyhow::bail!(\"core /proxies missing built-in {builtin}; response not ready\");\n    }\n}\nlet proxies = Proxies::from_responses(proxies_res, providers_res)?;","handlingStrategy":"validation","validationCode":"if !proxies_res.proxies.contains_key(\"REJECT\") {\n    anyhow::bail!(\"core /proxies not ready: missing REJECT\");\n}","typeGuard":"fn has_builtin_proxies(res: &api::ProxiesRes) -> bool {\n    res.proxies.contains_key(\"DIRECT\") && res.proxies.contains_key(\"REJECT\")\n}","tryCatchPattern":"match Proxies::from_responses(proxies_res, providers_res) {\n    Ok(p) => p,\n    Err(e) if e.to_string().contains(\"REJECT is missing\") => {\n        anyhow::bail!(\"core response malformed or not ready, retry: {e}\")\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Verify both DIRECT and REJECT exist in /proxies before parsing","Only fetch /proxies after the core reports readiness","Check the controller address/secret so you never parse an error body","Keep cores on standard versions whose API includes built-in entries"],"tags":["rust","clash","mihomo","api","proxies"],"backgroundTag":"unexpected-api-response-shape","analyzedSha":"f7dbce2997c633e484f54788035e770b3ee99773","analyzedAt":"2026-09-08T01:24:59.197Z","contentChangedAt":"2026-09-08T01:24:59.197Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}