libnyanpasu/clash-nyanpasu · warning

remove index invalid, skipped

Error message

remove index invalid, skipped

What it means

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.

Source

Thrown at backend/nyanpasu-config/src/runtime/executor/overlay.rs:294

                    ))),
                }
            }
            ConfigValue::Number(index) => {
                // Legacy numeric removal applies to sequence items only
                // (merge.rs:221 `Value::Sequence(list) if key.is_i64()`).
                if !matches!(current, ConfigValue::Array(_)) {
                    logs.push(StepLogEntry::warn(
                        "remove index on non-sequence item, skipped",
                    ));
                    continue;
                }
                let removed = index
                    .as_u64()
                    .map(|index| index.to_string())
                    .and_then(|segment| remove_at(&current, &[segment]));
                match removed {
                    Some(next) => current = next,
                    None => logs.push(StepLogEntry::warn("remove index invalid, skipped")),
                }
            }
            _ => logs.push(StepLogEntry::warn("invalid remove entry, skipped")),
        }
    }
    current
}

View on GitHub (pinned to f7dbce2997)

Solutions

  1. 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.
  2. Fix the filter's index value to a valid in-range position, or replace the index selector with a more stable key/path selector.
  3. If the target may legitimately be absent, treat this warning as expected and no action is needed — the step is intentionally skipped, not fatal.
  4. Add validation of overlay filter entries (path exists, target is array, index in range) before applying the overlay to surface errors early.

Example fix

// before (overlay filter)
{ "op": "remove", "index": 99 }  // proxies has only 12 entries -> warn, skipped
// after
{ "op": "remove", "index": 3 }  // valid index within proxies array
Defensive patterns

Strategy: validation

Validate before calling

const target = getAtPath(value, entry.index);
if (!Array.isArray(value) || entry.index < 0 || entry.index >= value.length) {
  console.warn('remove index out of range; fix filter or skip entry');
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of libnyanpasu/clash-nyanpasu@f7dbce2997 (2026-09-08). Data as JSON: /api/errors/1f2c9de40f4af5d1. Report an issue: GitHub.