iflytek/astron-agent · warning · Error

space.spaceNameExists

Error message

space.spaceNameExists

What it means

defaultSubmitHandle in the space modal calls checkName before create/edit; when the space name is already taken, it throws Error(t('space.spaceNameExists')) so the form surfaces a duplicate-name validation failure to the user and aborts the submit.

Solutions

  1. Choose a different, unique space name.
  2. Check for hidden whitespace/case differences in the name field.
  3. If the name is believed free, verify via the space list whether a soft-deleted space still holds the name.
  4. Refresh the form and resubmit in case of stale duplicate detection.

Example fix

// before
const name = values.name;
// after
const name = values.name.trim();
if (spaces.some(s => s.name.toLowerCase() === name.toLowerCase())) {
  message.warning(t('space.spaceNameExists'));
  return;
}
Defensive patterns

Strategy: try-catch

Validate before calling

const exists = spaces.some(s => s.name.trim().toLowerCase() === name.trim().toLowerCase());
if (exists) { message.warning(t('space.spaceNameExists')); return; }

Try / catch

try {
  await submitSpace(params);
} catch (e) {
  if (e.message.includes('spaceNameExists')) {
    form.setFields([{ name: 'name', errors: [t('space.spaceNameExists')] }]);
  } else { throw e; }
}

Prevention

When it happens

Trigger: Creating a space whose name matches an existing space in the same scope, or renaming a space to a name already used by another space (checkParams includes id only in edit mode).

Common situations: Duplicate naming by team members, case/whitespace variants that still collide, stale form data resubmitted after the space was created in another tab.

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/ef2cf621cef08a8c. Report an issue: GitHub.

Appendix: source

Thrown at console/frontend/src/components/space/space-modal/index.tsx:101

    },
    edit: {
      handler: editSpace,
      postProcess: async () => {
        // 编辑模式无需额外处理
      },
    },
  };

  const defaultSubmitHandle = async (data: Record<string, any>) => {
    const checkParams = {
      name,
      id: mode === 'create' ? '' : initialData?.id,
    };
    const checkRes = await checkName(checkParams);

    if (checkRes) {
      console.log(t('space.spaceNameExists'));
      throw new Error(t('space.spaceNameExists'));
    }

    // 🎯 使用策略模式统一处理
    const currentHandler = modeHandlers[mode as keyof typeof modeHandlers];
    const res: any = await currentHandler.handler({
      ...initialData,
      ...data,
    });
    await currentHandler.postProcess(res);
  };

  const handleSubmit = async () => {
    try {
      const values = await form.validateFields();
      // 将头像地址添加到提交数据中
      const submitData = {
        ...values,
        avatarUrl,

View on GitHub (pinned to 5e758547a8)