{"record":{"id":"06c6102cf8bccaa2","repo":"libnyanpasu/clash-nyanpasu","slug":"invalid-remove-entry-skipped","errorCode":null,"errorMessage":"invalid remove entry, skipped","messagePattern":"invalid remove entry, skipped","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"backend/nyanpasu-config/src/runtime/executor/overlay.rs","lineNumber":297,"sourceCode":"            ConfigValue::Number(index) => {\n                // Legacy numeric removal applies to sequence items only\n                // (merge.rs:221 `Value::Sequence(list) if key.is_i64()`).\n                if !matches!(current, ConfigValue::Array(_)) {\n                    logs.push(StepLogEntry::warn(\n                        \"remove index on non-sequence item, skipped\",\n                    ));\n                    continue;\n                }\n                let removed = index\n                    .as_u64()\n                    .map(|index| index.to_string())\n                    .and_then(|segment| remove_at(&current, &[segment]));\n                match removed {\n                    Some(next) => current = next,\n                    None => logs.push(StepLogEntry::warn(\"remove index invalid, skipped\")),\n                }\n            }\n            _ => logs.push(StepLogEntry::warn(\"invalid remove entry, skipped\")),\n        }\n    }\n    current\n}\n","sourceCodeStart":279,"sourceCodeEnd":302,"githubUrl":"https://github.com/libnyanpasu/clash-nyanpasu/blob/f7dbce2997c633e484f54788035e770b3ee99773/backend/nyanpasu-config/src/runtime/executor/overlay.rs#L279-L302","documentation":"remove_from_item matched a `remove` filter entry whose shape is not one of the recognized selector forms (e.g. neither a path string nor an index number), so it cannot be applied at all. The executor logs a warning and skips the entry rather than rejecting the whole overlay. This protects config generation from malformed or unsupported remove rules.","triggerScenarios":"A `remove` operation in a filter is not an object with a recognized selector (not a path/string form, and the matched arm falls through to the wildcard `_` arm), e.g. {op: remove, foo: ...} with an unknown selector key, or a remove entry whose payload has the wrong JSON type.","commonSituations":"Hand-edited or AI/tool-generated overlay JSON uses a selector style the executor does not support; schema evolution after a version change renames the selector field so old entries hit the default arm.","solutions":["Inspect the offending filter entry in the overlay config and check it against the supported remove selector forms (path string or index number).","Rewrite the entry using a supported selector, e.g. {\"op\": \"remove\", \"path\": \"dns.rules[0]\"} or {\"op\": \"remove\", \"index\": 2}.","Remove the malformed entry entirely if the removal is no longer needed.","If the selector form is genuinely needed, extend remove_from_item with a new match arm and unit tests."],"exampleFix":"// before (overlay filter entry)\n{ \"op\": \"remove\", \"target\": \"rules\" }  // unknown selector -> warn, skipped\n// after\n{ \"op\": \"remove\", \"path\": \"rules\" }  // supported path selector","handlingStrategy":"validation","validationCode":"const isSupportedRemoveEntry = (e) =>\n  e != null && typeof e === 'object' &&\n  (typeof e.path === 'string' || typeof e.index === 'number');\nif (!isSupportedRemoveEntry(entry)) throw new Error('unsupported remove selector');","typeGuard":"function isRemoveEntry(e: unknown): e is { op: 'remove'; path?: string; index?: number } {\n  return typeof e === 'object' && e !== null &&\n    (typeof (e as any).path === 'string' || typeof (e as any).index === 'number');\n}","tryCatchPattern":null,"preventionTips":["Author overlay remove entries only with documented selectors (path string or index number).","Validate overlay JSON against the filter schema before saving it.","Re-check overlay entries after upgrading to a version that changes the filter schema."],"tags":["overlay","config","schema","malformed-entry"],"backgroundTag":"invalid-argument-format","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"}