jlcodes99/cockpit-tools · error
[AccountGroups] Invalid group at index ${index}
Error message
[AccountGroups] Invalid group at index ${index} What it means
Validation in parseGroups: element at the given index of the parsed array is not a plain object (null, an array, or a primitive). Each entry of the stored groups array must be an object with id/name/accountIds, so a malformed element aborts the whole load.
Source
Thrown at src/services/accountGroupService.ts:60
accountIds: [...group.accountIds],
}));
}
function parseGroups(raw: string): AccountGroup[] {
let parsed: unknown;
try {
parsed = JSON.parse(raw);
} 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],View on GitHub (pinned to 1ed8b77992)
Solutions
- Open the groups file, locate the index reported in the error, and fix or remove the malformed entry
- Restore from a backup taken before the corruption
- Check what wrote a non-object entry (schema drift or manual edit) and align it with AccountGroup
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at src/services/accountGroupService.ts:60 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/d541a7b0ee46ab63.
Report an issue: GitHub.