jlcodes99/cockpit-tools · error
[AccountGroups] Group ${index} has invalid account ids
Error message
[AccountGroups] Group ${index} has invalid account ids What it means
Validation in parseGroups: the group at the reported index has an accountIds field that is not an array of strings. accountIds is the membership list binding accounts to the group, so a malformed list means the group cannot be safely used and the load aborts.
Source
Thrown at src/services/accountGroupService.ts:71
if (!Array.isArray(parsed)) {
throw new Error('[AccountGroups] Stored data must be a JSON array');
}
const groups = parsed.map((value, index) => {
if (!value || typeof value !== 'object' || Array.isArray(value)) {
throw new Error(`[AccountGroups] Invalid group at index ${index}`);
}
const group = value as Record<string, unknown>;
if (typeof group.id !== 'string' || !group.id.trim()) {
throw new Error(`[AccountGroups] Group ${index} has an invalid id`);
}
if (typeof group.name !== 'string') {
throw new Error(`[AccountGroups] Group ${index} has an invalid name`);
}
if (!Array.isArray(group.accountIds) || group.accountIds.some((id) => typeof id !== 'string')) {
throw new Error(`[AccountGroups] Group ${index} has invalid account ids`);
}
return {
...group,
id: group.id,
name: group.name,
accountIds: [...group.accountIds],
// Keep older files without createdAt readable without treating them as
// an empty data set.
createdAt: typeof group.createdAt === 'number' ? group.createdAt : 0,
} as AccountGroup;
});
return cloneGroups(groups);
}
async function loadGroupsFromDisk(): Promise<AccountGroup[]> {
try {View on GitHub (pinned to 1ed8b77992)
Solutions
- Repair accountIds in the stored JSON so it is an array of string account ids
- Drop membership entries pointing at deleted accounts, keeping the array shape
- Harden the save path to always write an array of strings even when membership is empty
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at src/services/accountGroupService.ts:71 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of jlcodes99/cockpit-tools@1ed8b77992 (2026-09-05).
Data as JSON: /api/errors/df0841cf3f0cb512.
Report an issue: GitHub.