appsmithorg/appsmith · error · SubmissionError

error

Error message

error

What it means

Thrown in inviteUsersToWorkspaceSubmitHandler(). It dispatches INVITE_USERS_TO_WORKSPACE_INIT with resolve/reject tied to a Promise; if the saga rejects (e.g. server-side validation of emails/roles), the .catch wraps the payload in redux-form's SubmissionError. The literal message 'error' is just the default fallback; the real user-facing messages come from the rejected payload object (typically {usersByRole, _error}) which redux-form maps onto form fields. SubmissionError is redux-form's signal that submission failed with field-level errors rather than an unexpected throw.

Source

Thrown at app/client/src/ce/pages/workspace/helpers.ts:85

  dispatch: any, // TODO: Fix this the next time the file is edited
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
): Promise<any> => {
  const data = values.usersByRole.map((value) => ({
    permissionGroupId: value.permissionGroupId,
    emails: value.users ? value.users.split(",") : [],
  }));

  return new Promise((resolve, reject) => {
    dispatch({
      type: ReduxActionTypes.INVITE_USERS_TO_WORKSPACE_INIT,
      payload: {
        resolve,
        reject,
        data,
      },
    });
  }).catch((error) => {
    throw new SubmissionError(error);
  });
};

export const inviteUsersToWorkspace = async (
  // TODO: Fix this the next time the file is edited
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
  values: any,
  // TODO: Fix this the next time the file is edited
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
  dispatch: any,
  // TODO: Fix this the next time the file is edited
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
): Promise<any> => {
  const data = {
    permissionGroupId: values.permissionGroupId,
    usernames: values.users ? values.users.split(",") : [],
    workspaceId: values.workspaceId,
    ...("recaptchaToken" in values && {

View on GitHub (pinned to 8cd9021c24)

Solutions

  1. Validate emails client-side before submit so common typos never reach the saga.
  2. Ensure the rejected payload from the saga is shaped for redux-form (field-keyed, e.g. { usersByRole: '...' } or { _error: '...' }) so errors render on the right field.
  3. If you see a generic 'error' string, inspect the saga's reject() call and the backend response to map the message onto a field.
  4. Handle SubmissionError in the form's onSubmit (redux-form catches it automatically) — do not let it propagate as an uncaught exception.

Example fix

// before
.catch((error) => { throw new SubmissionError(error); })
// backend returns { error: 'Invalid email' } -> renders as generic form error

// after (shape the payload for redux-form fields)
.catch((error) => {
  throw new SubmissionError({ usersByRole: error.message, _error: error.message });
})
Defensive patterns

Strategy: try-catch

Validate before calling

function validEmails(list: string) {
  return list.split(',').map(s => s.trim()).every(e => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e));
}
if (!validEmails(values.usersByRole.map(r => r.users).join(','))) {
  throw new SubmissionError({ usersByRole: 'One or more emails are invalid' });
}

Type guard

const isSubmissionErrorPayload = (e: unknown): e is Record<string, string> =>
  typeof e === 'object' && e !== null && Object.values(e).every(v => typeof v === 'string');

Try / catch

.catch((error) => {
  // Map backend payload onto redux-form fields; fall back to _error
  throw new SubmissionError(isSubmissionErrorPayload(error) ? error : { _error: String(error?.message ?? error) });
})

Prevention

When it happens

Trigger: Submitting the invite-users-to-workspace form and having the backend reject it: invalid email syntax, unknown role/permissionGroupId, duplicate invitations, or rate limiting. The saga calls reject(errorPayload), the catch re-throws as SubmissionError so redux-form renders the per-field errors.

Common situations: Typo in an invited email; selecting a role the current user cannot grant; inviting an already-member email; backend returns a generic {error:'...'} that does not map to a form field, surfacing as a generic form error.

Related errors


AI-assisted analysis of appsmithorg/appsmith@8cd9021c24 (2026-08-12). Data as JSON: /api/errors/d72ec897109c9f4f. Report an issue: GitHub.