{"record":{"id":"d97b7764c6e08b8e","repo":"libnyanpasu/clash-nyanpasu","slug":"invalid-filter-value-skipped","errorCode":null,"errorMessage":"invalid filter value, skipped","messagePattern":"invalid filter value, skipped","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"backend/nyanpasu-config/src/runtime/executor/overlay.rs","lineNumber":248,"sourceCode":"                        FilterAction::Merge(merge) => {\n                            // Legacy panics on non-mapping items (merge.rs:163\n                            // `as_mapping_mut().unwrap()`); never-fail keeps\n                            // the item instead (spec §13 #15).\n                            if item.as_object_arc().is_none() {\n                                logs.push(StepLogEntry::warn(\n                                    \"filter `merge` target item is not a mapping, item kept\",\n                                ));\n                                return item;\n                            }\n                            deep_merge_value(Some(&item), merge)\n                        }\n                        FilterAction::Remove(paths) => remove_from_item(item, paths, logs),\n                    }\n                })\n                .collect()\n        }\n        _ => {\n            logs.push(StepLogEntry::warn(\"invalid filter value, skipped\"));\n            items\n        }\n    }\n}\n\nfn remove_from_item(\n    item: ConfigValue,\n    paths: &Arc<[ConfigValue]>,\n    logs: &mut Vec<StepLogEntry>,\n) -> ConfigValue {\n    let mut current = item;\n    for path in paths.iter() {\n        match path {\n            ConfigValue::String(dotted) => {\n                // Legacy applies string paths to mapping items only\n                // (merge.rs:186 `key.is_string() && item.is_mapping()`).\n                if current.as_object_arc().is_none() {\n                    logs.push(StepLogEntry::warn(format!(","sourceCodeStart":230,"sourceCodeEnd":266,"githubUrl":"https://github.com/libnyanpasu/clash-nyanpasu/blob/f7dbce2997c633e484f54788035e770b3ee99773/backend/nyanpasu-config/src/runtime/executor/overlay.rs#L230-L266","documentation":"apply_filter only accepts filters that are arrays of predicates or objects with `when` plus an action. Any other filter value type (scalar like a number/bool, or malformed structure) is rejected with this warning and the items pass through unfiltered.","triggerScenarios":"An overlay filter step's `filter` value is a string, number, boolean, or other unrecognized shape.","commonSituations":"YAML quoting mistakes turning an intended object filter into a string; copy-paste of a predicate expression where a filter object is expected.","solutions":["Wrap the predicate in a proper filter object: `{ when: \"...\", ...action }`","Check YAML indentation so the filter parses as a mapping/array, not a scalar","Quote strings only where expressions are expected (`when` values), not at the filter level","Log and inspect the parsed filter value if unsure what shape it has"],"exampleFix":"// before (parses as a string)\nfilter: \"item.name != 'DIRECT'\"\n// after\nfilter:\n  when: \"item.name != 'DIRECT'\"\n  remove: [\"udp\"]","handlingStrategy":"validation","validationCode":"let valid = matches!(&filter, ConfigValue::Array(_))\n    || matches!(&filter, ConfigValue::Object(a) if a.contains_key(\"when\"));\nassert!(valid, \"filter must be an array of predicates or an object with `when`\");","typeGuard":"fn is_valid_filter(v: &ConfigValue) -> bool {\n    matches!(v, ConfigValue::Array(_)) || matches!(v, ConfigValue::Object(a) if a.contains_key(\"when\"))\n}","tryCatchPattern":null,"preventionTips":["Check YAML indentation so filters parse as mappings/arrays, not strings","Quote expressions only inside `when` values","Validate the parsed filter shape before apply_overlay"],"tags":["config","filter","validation"],"backgroundTag":"invalid-config-value","analyzedSha":"f7dbce2997c633e484f54788035e770b3ee99773","analyzedAt":"2026-09-08T01:24:59.197Z","contentChangedAt":"2026-09-08T01:24:59.197Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}