{"record":{"id":"78eaa730fc90e648","repo":"libnyanpasu/clash-nyanpasu","slug":"invalid-filter-no-action","errorCode":null,"errorMessage":"invalid filter: no action","messagePattern":"invalid filter: no action","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"backend/nyanpasu-config/src/runtime/executor/overlay.rs","lineNumber":201,"sourceCode":"            enum FilterAction<'a> {\n                Expr(&'a str),\n                Override(&'a ConfigValue),\n                Merge(&'a ConfigValue),\n                Remove(&'a Arc<[ConfigValue]>),\n            }\n            let action = if let Some(ConfigValue::String(expr)) = actions.get(\"expr\") {\n                FilterAction::Expr(expr.as_ref())\n            } else if let Some(replacement) = actions.get(\"override\") {\n                FilterAction::Override(replacement)\n            } else if let Some(merge) = actions\n                .get(\"merge\")\n                .filter(|value| value.as_object_arc().is_some())\n            {\n                FilterAction::Merge(merge)\n            } else if let Some(ConfigValue::Array(paths)) = actions.get(\"remove\") {\n                FilterAction::Remove(paths)\n            } else {\n                logs.push(StepLogEntry::warn(\"invalid filter: no action\"));\n                return items;\n            };\n            items\n                .into_iter()\n                .map(|item| {\n                    let hit = match runner.eval_item_predicate(when, &item) {\n                        Ok(hit) => hit,\n                        Err(error) => {\n                            logs.push(StepLogEntry::warn(format!(\n                                \"filter `when` failed, treated as false: {error}\"\n                            )));\n                            false\n                        }\n                    };\n                    if !hit {\n                        return item;\n                    }\n                    match &action {","sourceCodeStart":183,"sourceCodeEnd":219,"githubUrl":"https://github.com/libnyanpasu/clash-nyanpasu/blob/f7dbce2997c633e484f54788035e770b3ee99773/backend/nyanpasu-config/src/runtime/executor/overlay.rs#L183-L219","documentation":"apply_filter parsed a valid object filter with a `when` predicate, but none of the recognized action keys (override, merge, remove) were present, so no action can run. It warns and returns the items unfiltered.","triggerScenarios":"A filter object has `when` but its action key is misspelled or missing (e.g. `merges`, `del`, `override` holding a non-object value, `remove` not being an array).","commonSituations":"Typos in action names; `remove` written as a string instead of an array of paths; copy-pasted filter snippets from older schema versions.","solutions":["Add one of the supported action keys: `override` (any value), `merge` (mapping), or `remove` (array of paths)","Fix typos in the action key name","Ensure `remove` is an array, not a string","Cross-check the filter schema in the overlay docs"],"exampleFix":"// before\nfilter:\n  when: \"item.name == 'A'\"\n  removes:\n    - udp\n// after\nfilter:\n  when: \"item.name == 'A'\"\n  remove:\n    - udp","handlingStrategy":"validation","validationCode":"if let ConfigValue::Object(actions) = &filter {\n    let has_action = actions.contains_key(\"override\")\n        || matches!(actions.get(\"merge\"), Some(ConfigValue::Object(_)))\n        || matches!(actions.get(\"remove\"), Some(ConfigValue::Array(_)));\n    assert!(has_action, \"filter must define override, merge, or remove\");\n}","typeGuard":"fn filter_has_action(f: &ConfigValue) -> bool {\n    matches!(f, ConfigValue::Object(a) if a.contains_key(\"override\") || a.contains_key(\"merge\") || a.contains_key(\"remove\"))\n}","tryCatchPattern":null,"preventionTips":["Use exact action key names: override, merge, remove","Ensure `remove` is an array and `merge` is a mapping","Test filter steps on a sample profile before shipping configs"],"tags":["config","filter","validation"],"backgroundTag":"missing-required-config-field","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"}