peass-ng/PEASS-ng · error · ValueError
{item_id} is not in the list
Error message
{item_id} is not in the list What it means
LinpeasModuleList.index() searches the list for a module whose id matches item_id and raises ValueError when no module has that id. It is used internally by remove(), so removing a module by an unknown id string triggers this error.
Source
Thrown at linPEAS/builder/src/linpeasModule.py:266
class LinpeasModuleList(list):
def __contains__(self, item):
# Check if item is already a LinpeasModule object.
if isinstance(item, LinpeasModule):
return super().__contains__(item)
# Otherwise, treat the item as the id of a LinpeasModule.
for module in self:
if module.id == item:
return True
return False
def index(self, item_id):
for index, module in enumerate(self):
if module.id == item_id:
return index
raise ValueError(f"{item_id} is not in the list")
def remove(self, item):
# If item is an id, find the corresponding object first.
if not isinstance(item, LinpeasModule):
index = self.index(item)
super().pop(index)
else:
super().remove(item)
def insert(self, index, item):
# Ensure that item is a LinpeasModule object before inserting.
if not isinstance(item, LinpeasModule):
raise ValueError("Item should be an instance of LinpeasModule")
super().insert(index, item)
def copy(self):
return LinpeasModuleList(super().copy())
View on GitHub (pinned to 53fb989abc)
Solutions
- Verify the module id against the ids actually present (e.g. [m.id for m in module_list])
- Catch ValueError around remove/index if absence is acceptable
- Use the LinpeasModule object directly with remove() instead of the id
Example fix
# before
modules.remove("linpeas_sudo")
# after
if "linpeas_sudo" in [m.id for m in modules]:
modules.remove("linpeas_sudo") Defensive patterns
Strategy: try-catch
Validate before calling
ids = {m.id for m in module_list}
if module_id not in ids:
print(f"{module_id} not present; skipping removal") Type guard
def is_in_list(module_list, item_id) -> bool:
return any(m.id == item_id for m in module_list) Try / catch
begin
modules.remove(module_id)
rescue ValueError => e
puts "Module not found: #{e.message}"
end
# python
try:
modules.remove(module_id)
except ValueError as e:
print(f"Module not found: {e}") Prevention
- Print [m.id for m in modules] before removing by id
- Reference module ids from constants, not hand-typed strings
- Remove by LinpeasModule object when you already hold it
When it happens
Trigger: Calling LinpeasModuleList.index('some_id') or LinpeasModuleList.remove('some_id') where no LinpeasModule in the list has id == 'some_id'.
Common situations: Scripting the build pipeline with a hard-coded module id that was renamed or deleted upstream; passing a full path instead of the module id; case/typo differences in the id.
Related errors
AI-assisted analysis of peass-ng/PEASS-ng@53fb989abc (2026-09-02).
Data as JSON: /api/errors/223c5b3897fe7c86.
Report an issue: GitHub.