jlcodes99/cockpit-tools · warning
platformLayout.groupNameRequired
platformLayout.groupNameRequired
Error message
platformLayout.groupNameRequired
What it means
When renaming an account group in the Accounts page, the controller trims the submitted name and rejects an empty result by throwing an Error whose message is the localized string 'platformLayout.groupNameRequired'. The i18n key doubles as the error code; the UI is expected to surface it to the user as 'group name is required'.
Source
Thrown at src/pages/AccountsPage.tsx:2900
setShowTagModal(null);
window.requestAnimationFrame(() => {
window.requestAnimationFrame(() => {
window.scrollTo({ top: scrollY, behavior: 'auto' })
})
})
};
const handleAssignAccountsToGroup = async (
groupId: string,
groupName: string,
accountIds: string[]
) => {
const currentGroup = accountGroups.find((group) => group.id === groupId)
if (!currentGroup) return
const nextName = groupName.trim()
if (!nextName) {
throw new Error(t('platformLayout.groupNameRequired'))
}
if (accountGroups.some((group) => group.id !== groupId && group.name === nextName)) {
throw new Error(t('accounts.groups.error.duplicate'))
}
const currentIds = new Set(currentGroup.accountIds)
const nextIds = new Set(accountIds)
const addedIds = accountIds.filter((accountId) => !currentIds.has(accountId))
const removedIds = currentGroup.accountIds.filter((accountId) => !nextIds.has(accountId))
const shouldRename = nextName !== currentGroup.name
if (!shouldRename && addedIds.length === 0 && removedIds.length === 0) return
if (shouldRename) {
await renameGroup(groupId, nextName)
}
View on GitHub (pinned to 1ed8b77992)
Solutions
- Populate the groupName field before submitting the rename (disable the confirm button while the input is empty).
- Validate on the caller side: trim the name and bail out early if it is falsy before invoking the handler.
- Catch the error in the calling controller/UI and show the localized validation message instead of letting it propagate.
Example fix
// before await controller.renameGroup(groupId, nameInput.value); // after const name = nameInput.value.trim(); if (!name) return; // or show validation message await controller.renameGroup(groupId, name);
Defensive patterns
Strategy: validation
Validate before calling
const name = groupName.trim();
if (!name) throw new Error(t('platformLayout.groupNameRequired')); Type guard
const hasGroupName = (v: unknown): v is string => typeof v === 'string' && v.trim().length > 0;
Try / catch
try {
await controller.renameGroup(groupId, groupName);
} catch (e) {
if (e.message === t('platformLayout.groupNameRequired')) {
showFieldError('groupName', e.message);
return;
}
throw e;
} Prevention
- Disable the rename confirm button while the trimmed input is empty.
- Trim names at form-submit boundaries, not just at display time.
- Run a shared required-field validator before calling the controller.
When it happens
Trigger: Calling the account-group rename handler (inside useAccountsPageController) with a groupName that is empty or consists only of whitespace after trim().
Common situations: User clears the group name input and confirms the rename dialog; a form submits with an unvalidated empty text field; a script/automation invokes the controller directly with ''.
Understand the failure class
Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.
Related errors
- accounts.groups.error.duplicate
- invalidJsonMessage
- messages.noItems
- messages.providerMismatch
- invalid_bundle_root
AI-assisted analysis of jlcodes99/cockpit-tools@1ed8b77992 (2026-09-05).
Data as JSON: /api/errors/2c01f42ed596308e.
Report an issue: GitHub.