different-ai/openwork · error · Error
Failed to update organization (${response.status}).
Error message
Failed to update organization (${response.status}). What it means
Thrown by updateOrganizationSettings (invoked by updateOrganizationName) in org-dashboard-provider.tsx when the organization settings POST returns non-ok. The request is wrapped in runReauthableAction, so 403 reauth challenges are retried after re-authentication; all other failures propagate this error with the server's message. On success — and when still on ORG_SETTINGS_PATH — a completion event is published.
Source
Thrown at ee/apps/den-web/app/(den)/dashboard/_providers/org-dashboard-provider.tsx:558
body.brandIconUrl = input.brandIconUrl;
}
if (input.brandAccentColor !== undefined) {
body.brandAccentColor = input.brandAccentColor;
}
await runMutation("update-organization-settings", async () => {
ensureActiveOrganizationSelected();
const { response, payload } = await requestJson(
"/v1/org",
{
method: "PATCH",
body: JSON.stringify(body),
},
12000,
);
if (!response.ok) {
throw getRequestError(payload, response, `Failed to update organization (${response.status}).`);
}
});
if (shouldPublishOrgSettingsCompletion && pathnameRef.current === ORG_SETTINGS_PATH) {
publishOrgSettingsCompletion();
}
}
async function deleteOrganization() {
ensureCanDeleteOrganization();
await runReauthableAction("delete-organization", async () => {
ensureActiveOrganizationSelected();
const { response, payload } = await requestJson(
"/v1/org",
{ method: "DELETE" },
12000,
);View on GitHub (pinned to 2b7df46e8a)
Solutions
- Read the appended server message — name validation failures state the exact constraint.
- Validate the name client-side (non-empty, length/slug constraints) before calling updateOrganizationName.
- On 403 confirm the user is an org owner/admin; ReauthRequiredError is handled by runReauthableAction — ensure the caller doesn't swallow its retry flow.
- If 404/409, refresh the org list; the org may have been renamed/deleted elsewhere.
- Retry on 429/5xx; investigate Den server health if persistent.
Example fix
// before
await updateOrganizationName(name);
// after: pre-validate the name
const trimmed = name.trim();
if (!trimmed || trimmed.length > 64) {
setError("Organization name must be 1-64 characters.");
return;
}
await updateOrganizationName(trimmed); Defensive patterns
Strategy: validation
Validate before calling
const name = candidate.trim();
if (!name) throw new Error("Organization name cannot be empty.");
if (name.length > 64) throw new Error("Organization name must be at most 64 characters.");
if (!orgId) throw new Error("No organization selected."); Type guard
function isReauthRequiredError(e: unknown): e is ReauthRequiredError {
return e instanceof ReauthRequiredError;
} Try / catch
try {
await updateOrganizationSettings(body);
} catch (err) {
if (isReauthRequiredError(err)) return; // runReauthableAction already handled retry
if (/\b(403|404)\b/.test(err.message)) { setError("You need org owner/admin rights for this organization."); return; }
setError(err.message);
} Prevention
- Validate the org name (non-empty, length, allowed characters) before sending.
- Only expose org settings editing to owner/admin roles.
- Ensure orgId in provider state matches the org the user is actively viewing; refresh on org switch.
- Keep the mutation inside runReauthableAction so 403 reauth is retried transparently.
- Publish completion only after success (shouldPublishOrgSettingsCompletion path already enforces this).
When it happens
Trigger: POST of the org settings body (name and related fields) with a 12s timeout returns 400 (invalid name: empty, too long, forbidden characters), 401 (expired session), 403 (not org owner/admin, or reauth challenge), 404 (orgId invalid), 409 (name conflict), 429, or 5xx. shouldPublishOrgSettingsCompletion gates the success path, so the error happens before any completion event fires.
Common situations: Renaming an org as a member without owner/admin rights; pasting a name exceeding server length limits; org id in the provider state stale after the user switched orgs; Den server outage.
Understand the failure class
Background: 'Something went wrong' / 'Request failed (500)' / 'HTTP error! status: 404' — what failed HTTP requests actually mean and how to find the real cause — this error's family across 28 libraries.
Related errors
- Failed to load organizations (${response.status}).
- Failed to switch organization (${response.status}).
- Failed to load organization (${response.status}).
- Failed to create organization (${response.status}).
- Failed to update SCIM group mapping (${response.status}).
AI-assisted analysis of different-ai/openwork@2b7df46e8a (2026-09-01).
Data as JSON: /api/errors/4a977af5fdcb4e75.
Report an issue: GitHub.