iflytek/astron-agent · warning · Error
t('space.teamNameExists', )
Error message
t('space.teamNameExists', { enterpriseType }) What it means
Team creation validates the proposed name with checkEnterpriseName(); if the backend reports the name is already taken, handleCreateTeam throws Error(textConfig.existTip), which resolves to t('space.teamNameExists', { enterpriseType }) — a localized 'team/enterprise name already exists' message. The thrown error propagates to form/error handling so the user can pick a different name.
Solutions
- Choose a different team name and resubmit — this is an expected, user-facing conflict.
- Pre-validate on blur/input with a debounced checkEnterpriseName call to surface conflicts before submit.
- Verify the i18n key 'space.teamNameExists' exists for all locales so the message renders instead of the raw key.
- If a false positive, confirm checkEnterpriseName scopes the uniqueness check to the correct space/tenant.
Example fix
// before
const checkRes = await checkEnterpriseName({ name });
if (checkRes) {
throw new Error(textConfig.existTip);
}
// after
const checkRes = await checkEnterpriseName({ name: name.trim() });
if (checkRes) {
form.setFields([{ name: 'name', errors: [textConfig.existTip] }]);
setLoading(false);
return; // surface as form error instead of uncaught throw
} Defensive patterns
Strategy: validation
Validate before calling
// before submit
const res = await checkEnterpriseName({ name: name.trim() });
if (res) {
form.setFields([{ name: 'name', errors: [textConfig.existTip] }]);
return;
} Type guard
function nameIsAvailable(res: unknown): boolean {
return !res; // truthy response means name taken
} Try / catch
try {
await handleCreateTeam(values);
} catch (e) {
message.error(e.message); // surfaces localized 'name exists' tip
setLoading(false);
} Prevention
- Debounce-check the name on field blur to catch conflicts before submit.
- Always trim/normalize the name before uniqueness checks.
- Confirm the i18n key space.teamNameExists exists in every locale file.
- Show a success-safe reset so retries don't resubmit stale names.
When it happens
Trigger: Submitting the team-create form with a name that already exists in the current tenant/space: checkEnterpriseName({ name }) returns truthy and the handler throws before calling createEnterprise.
Common situations: Two users creating similarly named teams concurrently; retrying a submission after a previous create partially succeeded; case/whitespace differences not counted by the checker but blocked by backend; stale form state resubmitting an old name.
Understand the failure class
Background: "already exists" / EEXIST / FileAlreadyExistsException: what the 'file already exists' error means and how to fix it — this error's family across 37 libraries.
Related errors
AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12).
Data as JSON: /api/errors/529d6296b43ec9ef.
Report an issue: GitHub.
Appendix: source
Thrown at console/frontend/src/pages/space/team-create/index.tsx:69
// 触发上传
const triggerFileSelectPopup = (callback: () => void) => {
setTriggerChild(false);
callback();
};
const handleCreateTeam = async () => {
const name = teamName.trim();
if (!name) {
message.error(textConfig.emptyTip);
return;
}
setLoading(true);
try {
const checkRes = await checkEnterpriseName({ name });
if (checkRes) {
throw new Error(textConfig.existTip);
}
const res: any = await createEnterprise({
name,
avatarUrl: logoUrl,
});
message.success(textConfig.createSuccessTip);
await getJoinedEnterpriseList();
handleTeamSwitch(res);
} catch (error: any) {
message.error(error?.message || error?.msg || textConfig.createFailedTip);
} finally {
setLoading(false);
}
};
return (View on GitHub (pinned to 5e758547a8)