libnyanpasu/clash-nyanpasu · warning
invalid remove entry, skipped
Error message
invalid remove entry, skipped
What it means
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.
Source
Thrown at backend/nyanpasu-config/src/runtime/executor/overlay.rs:297
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(¤t, &[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
- 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.
Example fix
// before (overlay filter entry)
{ "op": "remove", "target": "rules" } // unknown selector -> warn, skipped
// after
{ "op": "remove", "path": "rules" } // supported path selector Defensive patterns
Strategy: validation
Validate before calling
const isSupportedRemoveEntry = (e) =>
e != null && typeof e === 'object' &&
(typeof e.path === 'string' || typeof e.index === 'number');
if (!isSupportedRemoveEntry(entry)) throw new Error('unsupported remove selector'); Type guard
function isRemoveEntry(e: unknown): e is { op: 'remove'; path?: string; index?: number } {
return typeof e === 'object' && e !== null &&
(typeof (e as any).path === 'string' || typeof (e as any).index === 'number');
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.
Related errors
- overlay document is not a mapping, skipped
- merge value for `{field}` is not a sequence, skipped
- unrecognized typed config migration state: existing {} is ne
- unsupported migration store schema version {}
- profiles.yaml failed validation: {errors:?}
AI-assisted analysis of libnyanpasu/clash-nyanpasu@f7dbce2997 (2026-09-08).
Data as JSON: /api/errors/06c6102cf8bccaa2.
Report an issue: GitHub.