different-ai/openwork · warning

Enter an organization name.

Error message

Enter an organization name.

What it means

createOrganization throws this synchronous validation error when the supplied name is empty after trimming (name.trim() === ""). It is a client-side guard that fires before any network call and before the mutation-busy state is set.

Source

Thrown at ee/apps/den-web/app/(den)/dashboard/_providers/org-dashboard-provider.tsx:426

          ...retryAfterReauth,
          ...queuedDuringRetry,
        ];
        setReauthDialogOpen(true);
        return;
      }

      queuedActions = queuedDuringRetry;
    }
  }

  async function createOrganization(name: string) {
    if (isSingleOrgMode) {
      throw new Error("This deployment uses one managed organization.");
    }

    const trimmed = name.trim();
    if (!trimmed) {
      throw new Error("Enter an organization name.");
    }

    setMutationBusy("create-organization");
    setOrgError(null);
    try {
      const { response, payload } = await requestJson(
        "/v1/org",
        {
          method: "POST",
          body: JSON.stringify({ name: trimmed }),
        },
        12000,
      );

      if (!response.ok) {
        throw new Error(getErrorMessage(payload, `Failed to create organization (${response.status}).`));
      }

View on GitHub (pinned to 2b7df46e8a)

Solutions

  1. Validate the name in the form/UI before calling createOrganization (required-field check with minLength).
  2. Trim input at the form layer so trailing spaces don't silently produce this error.
  3. Catch the error and focus the name input with an inline validation message.
  4. Disable the submit button while the trimmed name is empty.

Example fix

// before
await createOrganization(nameInput.value);
// after
const trimmed = nameInput.value.trim();
if (!trimmed) {
  setNameFieldError("Enter an organization name.");
  return;
}
await createOrganization(trimmed);
Defensive patterns

Strategy: validation

Validate before calling

function canCreateOrg(name: string): boolean {
  return name.trim().length > 0;
}
if (!canCreateOrg(input)) disableSubmit();

Try / catch

try {
  await createOrganization(name);
} catch (err) {
  if (err.message === "Enter an organization name.") {
    focusNameInputWithError(err.message);
  } else throw err;
}

Prevention

When it happens

Trigger: Calling createOrganization("") or createOrganization(" "); a form submitting with a whitespace-only input; programmatic calls passing an uninitialized string variable.

Common situations: Users pressing Enter in an empty create-org dialog; an uncontrolled form input whose defaultValue never synced to state; e2e scripts sending blank names.

Related errors


AI-assisted analysis of different-ai/openwork@2b7df46e8a (2026-09-01). Data as JSON: /api/errors/a5faaea9a0f91aa3. Report an issue: GitHub.