{"record":{"id":"a72378af78f45289","repo":"jlcodes99/cockpit-tools","slug":"accountgroups-group-index-has-an-invalid-id","errorCode":null,"errorMessage":"[AccountGroups] Group ${index} has an invalid id","messagePattern":"\\[AccountGroups\\] Group (.+?) has an invalid id","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/services/accountGroupService.ts","lineNumber":65,"sourceCode":"  let parsed: unknown;\n  try {\n    parsed = JSON.parse(raw);\n  } catch (error) {\n    throw new Error(`[AccountGroups] Invalid JSON: ${String(error)}`);\n  }\n\n  if (!Array.isArray(parsed)) {\n    throw new Error('[AccountGroups] Stored data must be a JSON array');\n  }\n\n  const groups = parsed.map((value, index) => {\n    if (!value || typeof value !== 'object' || Array.isArray(value)) {\n      throw new Error(`[AccountGroups] Invalid group at index ${index}`);\n    }\n\n    const group = value as Record<string, unknown>;\n    if (typeof group.id !== 'string' || !group.id.trim()) {\n      throw new Error(`[AccountGroups] Group ${index} has an invalid id`);\n    }\n    if (typeof group.name !== 'string') {\n      throw new Error(`[AccountGroups] Group ${index} has an invalid name`);\n    }\n    if (!Array.isArray(group.accountIds) || group.accountIds.some((id) => typeof id !== 'string')) {\n      throw new Error(`[AccountGroups] Group ${index} has invalid account ids`);\n    }\n\n    return {\n      ...group,\n      id: group.id,\n      name: group.name,\n      accountIds: [...group.accountIds],\n      // Keep older files without createdAt readable without treating them as\n      // an empty data set.\n      createdAt: typeof group.createdAt === 'number' ? group.createdAt : 0,\n    } as AccountGroup;\n  });","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/jlcodes99/cockpit-tools/blob/1ed8b77992d62ca81fabf744deb0839ad361d5bf/src/services/accountGroupService.ts#L47-L83","documentation":"Validation in parseGroups: the group at the reported index has an id that is not a non-empty string (missing, non-string, or whitespace-only). The id is the primary key used to reference groups, so the entry is unusable and the whole file load fails fast.","triggerScenarios":"Thrown at src/services/accountGroupService.ts:65 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Edit the groups file and give the offending group a non-empty string id (e.g. a UUID)","Remove the broken group entry if it is no longer needed","Add a save-side check so groups are never persisted without a valid id"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"1ed8b77992d62ca81fabf744deb0839ad361d5bf","analyzedAt":"2026-09-05T09:51:41.178Z","contentChangedAt":"2026-09-05T09:51:41.178Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}