{"record":{"id":"e17718d41974b031","repo":"different-ai/openwork","slug":"scim-settings-were-updated-but-the-response-was-i","errorCode":null,"errorMessage":"SCIM settings were updated, but the response was incomplete.","messagePattern":"SCIM settings were updated, but the response was incomplete\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"ee/apps/den-web/app/(den)/dashboard/_components/scim-screen.tsx","lineNumber":265,"sourceCode":"    }\n\n    const groupMappingMode = connection.groupMappingMode === \"create_teams\"\n      ? \"metadata_only\"\n      : \"create_teams\";\n    setError(null);\n    setUpdatingGroupMapping(true);\n    try {\n      const { response, payload } = await requestJson(\n        \"/v1/scim\",\n        { method: \"PATCH\", body: JSON.stringify({ groupMappingMode }) },\n        12000,\n      );\n      if (!response.ok) {\n        throw getRequestError(payload, response, `Failed to update SCIM group mapping (${response.status}).`);\n      }\n      const parsed = parseOrgScimPayload(payload);\n      if (!parsed.connection) {\n        throw new Error(\"SCIM settings were updated, but the response was incomplete.\");\n      }\n      setConnection(parsed.connection);\n      setHealth(parsed.health);\n    } catch (nextError) {\n      setError(nextError instanceof Error ? nextError.message : \"Failed to update SCIM group mapping.\");\n    } finally {\n      setUpdatingGroupMapping(false);\n    }\n  }\n\n  async function handleDeleteConnection() {\n    if (!access.canManageScim) {\n      setError(\"Only workspace owners and super-admins can delete SCIM connections.\");\n      return;\n    }\n\n    if (\n      !orgId ||","sourceCodeStart":247,"sourceCodeEnd":283,"githubUrl":"https://github.com/different-ai/openwork/blob/2b7df46e8ae1517d64c896c7793d2d52ec845669/ee/apps/den-web/app/(den)/dashboard/_components/scim-screen.tsx#L247-L283","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Inspect the PATCH response payload to see the actual shape and which field is missing","Update parseOrgScimPayload to unwrap the real envelope used by this endpoint","Fix the endpoint to return the updated connection object on success","Refetch the SCIM config (GET) after the PATCH instead of relying on the PATCH response body"],"exampleFix":"// before\nconst parsed = parseOrgScimPayload(payload);\nif (!parsed.connection) {\n  throw new Error(\"SCIM settings were updated, but the response was incomplete.\");\n}\n// after\nlet parsed = parseOrgScimPayload(payload);\nif (!parsed.connection) {\n  const refetched = await requestJson(`/v1/organizations/${orgSlug}/scim`, { method: \"GET\" }, 15000);\n  parsed = parseOrgScimPayload(refetched.payload);\n}\nif (!parsed.connection) throw new Error(\"SCIM settings were updated, but the connection state could not be loaded.\");","handlingStrategy":"validation","validationCode":"const parsed = parseOrgScimPayload(payload);\nif (!parsed.connection || typeof parsed.connection !== \"object\") {\n  // fall back to a refetch instead of trusting the PATCH body\n  const fresh = await requestJson(`/v1/organizations/${orgSlug}/scim`, { method: \"GET\" }, 15000);\n  parsed = parseOrgScimPayload(fresh.payload);\n}","typeGuard":"function hasConnection(p: unknown): p is { connection: Record<string, unknown>; health?: unknown } {\n  return typeof p === \"object\" && p !== null && \"connection\" in p && typeof (p as { connection: unknown }).connection === \"object\" && (p as { connection: unknown }).connection !== null;\n}","tryCatchPattern":"try {\n  await updateGroupMapping(body);\n  const parsed = parseOrgScimPayload(payload);\n  if (!hasConnection(parsed)) throw new Error(\"SCIM settings were updated, but the response was incomplete.\");\n  setConnection(parsed.connection);\n} catch (error) {\n  setError(error instanceof Error ? error.message : \"Failed to update SCIM group mapping.\");\n}","preventionTips":["After mutating requests, prefer refetching canonical state over trusting the mutation body","Contract-test that the group-mapping PATCH returns the updated connection","Validate mutation responses with a schema (Zod) before applying them to state","Keep frontend and den-api deployed in lockstep on staging"],"tags":["scim","api","response-parsing"],"backgroundTag":"api-response-missing-field","analyzedSha":"2b7df46e8ae1517d64c896c7793d2d52ec845669","analyzedAt":"2026-09-01T07:59:23.713Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}