{"record":{"id":"1f2c9de40f4af5d1","repo":"libnyanpasu/clash-nyanpasu","slug":"remove-index-invalid-skipped","errorCode":null,"errorMessage":"remove index invalid, skipped","messagePattern":"remove index invalid, skipped","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"backend/nyanpasu-config/src/runtime/executor/overlay.rs","lineNumber":294,"sourceCode":"                    ))),\n                }\n            }\n            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":276,"sourceCodeEnd":302,"githubUrl":"https://github.com/libnyanpasu/clash-nyanpasu/blob/f7dbce2997c633e484f54788035e770b3ee99773/backend/nyanpasu-config/src/runtime/executor/overlay.rs#L276-L302","documentation":"In the overlay executor's remove_from_item step, a `remove` filter entry with an `index` selector was applied, but remove_at() returned None — the numeric index did not resolve to a removable element in the current config value. Instead of failing the whole overlay application, the executor logs a warning and continues with the unchanged value. This is a deliberate degradation path: bad remove selectors never break config generation.","triggerScenarios":"A filter entry like {op: remove, index: N} (parsed as a JSON number, converted to a string segment) where remove_at(&current, &[segment]) cannot remove at that position — e.g. current is not an array, or index N is past the end of the array, or current is an object/none value.","commonSituations":"A user-authored or provider-authored remove rule references an index that no longer exists after upstream subscription content changed (proxy list shrank or reordered); or a remove rule assumes the target key is an array but the merged value is a scalar or object.","solutions":["Print/log the `current` value and the index used in the filter entry and confirm the target array exists and has more than N elements.","Fix the filter's index value to a valid in-range position, or replace the index selector with a more stable key/path selector.","If the target may legitimately be absent, treat this warning as expected and no action is needed — the step is intentionally skipped, not fatal.","Add validation of overlay filter entries (path exists, target is array, index in range) before applying the overlay to surface errors early."],"exampleFix":"// before (overlay filter)\n{ \"op\": \"remove\", \"index\": 99 }  // proxies has only 12 entries -> warn, skipped\n// after\n{ \"op\": \"remove\", \"index\": 3 }  // valid index within proxies array","handlingStrategy":"validation","validationCode":"const target = getAtPath(value, entry.index);\nif (!Array.isArray(value) || entry.index < 0 || entry.index >= value.length) {\n  console.warn('remove index out of range; fix filter or skip entry');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate overlay filter entries (array exists, index in range) before applying the overlay.","Prefer stable path/key selectors over positional indexes that break when subscription content changes.","Regenerate or review remove rules after upstream profile schema changes."],"tags":["overlay","config","index-out-of-range","degradation"],"backgroundTag":"index-out-of-bounds","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"}