passbolt/passbolt_api · warning · ScimException

Invalid ResourceType

Error message

Invalid ResourceType

What it means

ScimResourceTypes::build() resolves a SCIM resource type name ('User' or 'Group') to its class via MAPPING; an unknown name throws ScimException 'Invalid ResourceType'. Passbolt only knows the User and Group resource types.

Solutions

  1. Use exactly 'User' or 'Group' (see ScimResourceTypes::TYPE_* constants); check GET /scim/v2.0/ResourceTypes for the supported list.
  2. Guard with ScimResourceTypes::isValid($name) before calling build().
  3. If the client needs additional resource types, extend MAPPING in ScimResourceTypes.php rather than expecting them to exist.

Example fix

// before
ScimResourceTypes::build('user'); // throws Invalid ResourceType
// after
if (ScimResourceTypes::isValid($name)) {
    $rt = ScimResourceTypes::build($name);
}
Defensive patterns

Strategy: validation

Validate before calling

if (!['User', 'Group'].includes(resourceTypeName)) {
  throw new Error(`Resource type ${resourceTypeName} not supported by passbolt SCIM`);
}

Type guard

function isKnownResourceType(name) {
  return name === 'User' || name === 'Group';
}

Try / catch

try {
  const rt = await fetchResourceType(name);
} catch (e) {
  if (e.response && e.response.status === 400) {
    // invalid resource type: refresh from GET /ResourceTypes
  }
}

Prevention

When it happens

Trigger: Requesting /scim/v2.0/ResourceTypes/{name} with a name other than 'User' or 'Group' (e.g. 'Entitlement', lowercase 'user'); calling ScimResourceTypes::build() with a mistyped name.

Common situations: IdP expecting resource types passbolt doesn't implement; case mismatch ('user' vs 'User'); custom integrations hardcoding wrong type names.

Related errors


AI-assisted analysis of passbolt/passbolt_api@31c1bbc10f (2026-09-17). Data as JSON: /api/errors/034592f0d77a84da. Report an issue: GitHub.

Appendix: source

Thrown at plugins/PassboltEe/Scim/src/Utility/ScimResourceTypes.php:80

            $resourceTypes[] = self::build($identifier);
        }

        return $resourceTypes;
    }

    /**
     * Build a ResourceType given the name
     *
     * @param string $name
     * @return \Passbolt\Scim\Utility\ScimObjectInterface
     * @throws \Passbolt\Scim\Exception\ScimException
     * @throws \Exception
     */
    public static function build(string $name): ScimObjectInterface
    {
        $class = self::MAPPING[$name] ?? null;
        if (!$class) {
            throw new ScimException(__('Invalid ResourceType'));
        }

        return new $class();
    }
}

View on GitHub (pinned to 31c1bbc10f)