antiwork/gumroad · error · ResponseError

Something went wrong.

Error message

Something went wrong.

What it means

updateMember PUTs a role change to Routes.settings_team_invitation_path or Routes.settings_team_member_path (app/javascript/data/settings/team.ts:42-54) and throws ResponseError with the default message 'Something went wrong.' when response.ok is false. ResponseError (app/javascript/utils/request.ts:27) is the app-wide fetch-wrapper error. Because request() already converts 5xx, 429 (RateLimitError), and network failures, this throw means a 4xx reached the handler: 401 (expired session), 403 (acting seller not allowed to manage roles), 404 (stale member/invitation id), or 422 (role not accepted).

Source

Thrown at app/javascript/data/settings/team.ts:53

  });
  if (response.ok) {
    return typia.assert<{ success: false; error_message: string } | { success: true }>(await response.json());
  }
  return { success: false, error_message: "Sorry, something went wrong. Please try again." };
};

export const updateMember = async (memberInfo: MemberInfo, role: Role) => {
  const requestInfo =
    memberInfo.type === "invitation"
      ? { url: Routes.settings_team_invitation_path(memberInfo.id, "json"), data: { team_invitation: { role } } }
      : { url: Routes.settings_team_member_path(memberInfo.id, "json"), data: { team_membership: { role } } };
  const response = await request({
    method: "PUT",
    accept: "json",
    ...requestInfo,
  });

  if (!response.ok) throw new ResponseError();
};

export const deleteMember = async (memberInfo: MemberInfo) => {
  const url =
    memberInfo.type === "invitation"
      ? Routes.settings_team_invitation_path(memberInfo.id, "json")
      : Routes.settings_team_member_path(memberInfo.id, "json");
  const response = await request({
    method: "DELETE",
    accept: "json",
    url,
  });

  if (!response.ok) throw new ResponseError();
};

export const resendInvitation = async (memberInfo: MemberInfo) => {
  const response = await request({

View on GitHub (pinned to afeacbd394)

Solutions

  1. Reload Settings > Team so memberInfo comes from a fresh list, then retry the role change
  2. Verify the acting account is the team owner — role management is owner-gated in the settings team controllers
  3. Confirm memberInfo.id still exists and memberInfo.type picks the right route at team.ts:44-46 (invitation vs membership)
  4. Check the browser network tab / Rails log for the exact 4xx status on the PUT before assuming a frontend bug
  5. Catch ResponseError and surface e.message as Show.tsx:259-262 already does, so the failure is never silent

Example fix

// before
if (!response.ok) throw new ResponseError();

// after — surface the server's reason, mirroring wishlists.ts:104-107
if (!response.ok) {
  const body: unknown = await response.json().catch(() => null);
  const message = typia.is<{ error: string }>(body) ? body.error : "Could not change this member's role.";
  throw new ResponseError(message);
}
Defensive patterns

Strategy: try-catch

Validate before calling

const canChangeRole = (m: MemberInfo, role: Role) =>
  ROLES.includes(role) && m.id !== "" && m.role !== role; // skip no-op / invalid PUTs (Show.tsx:248 checks the first two)
if (!canChangeRole(memberInfo, nextRole)) return;

Type guard

import { ResponseError } from "$app/utils/request";
const isResponseError = (e: unknown): e is ResponseError => e instanceof ResponseError;

Try / catch

import { assertResponseError } from "$app/utils/request";
try {
  await updateMember(memberInfo, role);
} catch (e) {
  assertResponseError(e); // rethrows non-ResponseError (e.g. typia failures) instead of swallowing
  showAlert(e.message, "error");
}

Prevention

When it happens

Trigger: Changing a team member's role from the Select in Settings > Team (pages/Settings/Team/Show.tsx:249 calls updateMember) when: the acting seller is not the team owner (403); the invitation was accepted or revoked in another tab so memberInfo.id no longer resolves (404); the role sent is not one of ROLES (422); or the page sat open past session expiry so the JSON PUT returns 401.

Common situations: Team settings page left open overnight (session expired); two owners editing the team concurrently so one acts on a deleted/changed member; tests stubbing these endpoints with non-2xx; an admin-role account (not owner) attempting role changes it is not permitted to make.

Related errors


AI-assisted analysis of antiwork/gumroad@afeacbd394 (2026-08-21). Data as JSON: /api/errors/dd621e7c78546782. Report an issue: GitHub.