different-ai/openwork · error

SCIM settings were updated, but the response was incomplete.

Error message

SCIM settings were updated, but the response was incomplete.

What it means

handleGroupMappingChange PATCHes the org's SCIM group mapping; on a 2xx it parses the response and requires a connection object to update local state. If parseOrgScimPayload yields no connection, it throws this error. The update was applied server-side but the client cannot refresh its view of the SCIM connection.

Source

Thrown at ee/apps/den-web/app/(den)/dashboard/_components/scim-screen.tsx:265

    }

    const groupMappingMode = connection.groupMappingMode === "create_teams"
      ? "metadata_only"
      : "create_teams";
    setError(null);
    setUpdatingGroupMapping(true);
    try {
      const { response, payload } = await requestJson(
        "/v1/scim",
        { method: "PATCH", body: JSON.stringify({ groupMappingMode }) },
        12000,
      );
      if (!response.ok) {
        throw getRequestError(payload, response, `Failed to update SCIM group mapping (${response.status}).`);
      }
      const parsed = parseOrgScimPayload(payload);
      if (!parsed.connection) {
        throw new Error("SCIM settings were updated, but the response was incomplete.");
      }
      setConnection(parsed.connection);
      setHealth(parsed.health);
    } catch (nextError) {
      setError(nextError instanceof Error ? nextError.message : "Failed to update SCIM group mapping.");
    } finally {
      setUpdatingGroupMapping(false);
    }
  }

  async function handleDeleteConnection() {
    if (!access.canManageScim) {
      setError("Only workspace owners and super-admins can delete SCIM connections.");
      return;
    }

    if (
      !orgId ||

View on GitHub (pinned to 2b7df46e8a)

Solutions

  1. Inspect the PATCH response payload to see the actual shape and which field is missing
  2. Update parseOrgScimPayload to unwrap the real envelope used by this endpoint
  3. Fix the endpoint to return the updated connection object on success
  4. Refetch the SCIM config (GET) after the PATCH instead of relying on the PATCH response body

Example fix

// before
const parsed = parseOrgScimPayload(payload);
if (!parsed.connection) {
  throw new Error("SCIM settings were updated, but the response was incomplete.");
}
// after
let parsed = parseOrgScimPayload(payload);
if (!parsed.connection) {
  const refetched = await requestJson(`/v1/organizations/${orgSlug}/scim`, { method: "GET" }, 15000);
  parsed = parseOrgScimPayload(refetched.payload);
}
if (!parsed.connection) throw new Error("SCIM settings were updated, but the connection state could not be loaded.");
Defensive patterns

Strategy: validation

Validate before calling

const parsed = parseOrgScimPayload(payload);
if (!parsed.connection || typeof parsed.connection !== "object") {
  // fall back to a refetch instead of trusting the PATCH body
  const fresh = await requestJson(`/v1/organizations/${orgSlug}/scim`, { method: "GET" }, 15000);
  parsed = parseOrgScimPayload(fresh.payload);
}

Type guard

function hasConnection(p: unknown): p is { connection: Record<string, unknown>; health?: unknown } {
  return typeof p === "object" && p !== null && "connection" in p && typeof (p as { connection: unknown }).connection === "object" && (p as { connection: unknown }).connection !== null;
}

Try / catch

try {
  await updateGroupMapping(body);
  const parsed = parseOrgScimPayload(payload);
  if (!hasConnection(parsed)) throw new Error("SCIM settings were updated, but the response was incomplete.");
  setConnection(parsed.connection);
} catch (error) {
  setError(error instanceof Error ? error.message : "Failed to update SCIM group mapping.");
}

Prevention

When it happens

Trigger: The group-mapping update endpoint returns ok but the body has no connection object — e.g. the endpoint returns only { ok: true }, returns an envelope parseOrgScimPayload doesn't handle, or omits connection when the mapping update partially failed server-side.

Common situations: API response contract change after refactor; mapping update silently no-ops for orgs without an active SCIM connection; proxy stripping the response body; frontend and API version mismatch on a staging environment.

Related errors


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