jlcodes99/cockpit-tools · error
[AccountGroups] Group ${index} has an invalid name
Error message
[AccountGroups] Group ${index} has an invalid name What it means
Validation in parseGroups: the group at the reported index has a name that is not a string (missing or wrong type). Every persisted group requires a display name, so the loader rejects the file rather than rendering a group without one.
Source
Thrown at src/services/accountGroupService.ts:68
} catch (error) {
throw new Error(`[AccountGroups] Invalid JSON: ${String(error)}`);
}
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);
}View on GitHub (pinned to 1ed8b77992)
Solutions
- Fix the group's name field in the stored JSON to a string (empty string is acceptable; wrong types are not)
- Restore the file from backup if the damage is broader
- Ensure the writer serializes name as a string on every save
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at src/services/accountGroupService.ts:68 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/744177bbbef35225.
Report an issue: GitHub.