{"record":{"id":"fbfa4c60b6fd95ec","repo":"apereo/cas","slug":"no-metadata-defined-for-entity","errorCode":null,"errorMessage":"No metadata defined for entity","messagePattern":"No metadata defined for entity","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"support/cas-server-support-oidc-federation/src/main/java/org/apereo/cas/oidc/federation/web/OidcFetchFederationEndpointController.java","lineNumber":84,"sourceCode":"\n        val error = retrieveInvalidIssuerError(request, response, OidcConstants.FETCH_FEDERATION_URL);\n        if (error != null) {\n            return error;\n        }\n\n        if (StringUtils.isBlank(sub)) {\n            val body = OAuth20Utils.getErrorResponseBody(OAuth20Constants.INVALID_REQUEST, \"Invalid entity\");\n            return new ResponseEntity<>(body, HttpStatus.BAD_REQUEST);\n        }\n\n        val foundSubordinate = subordinateRepository.getSubordinates().get(sub);\n        if (foundSubordinate == null) {\n            val body = OAuth20Utils.getErrorResponseBody(OAuth20Constants.INVALID_REQUEST, \"Invalid entity\");\n            return new ResponseEntity<>(body, HttpStatus.BAD_REQUEST);\n        }\n        val serviceMetadata = foundSubordinate.getMetadata();\n        if (serviceMetadata == null) {\n            throw new IllegalArgumentException(\"No metadata defined for entity\");\n        }\n        val federationKeys = foundSubordinate.getFederationKeys();\n        if (federationKeys == null || federationKeys.isEmpty()) {\n            throw new IllegalArgumentException(\"No federation keys defined for entity\");\n        }\n\n        val issuer = oidcProperties.getCore().getIssuer();\n        val metadata = (JSONObject) JSONValue.parse(serviceMetadata.toString());\n        return buildEntityStatement(issuer, sub, metadata, federationKeys, null);\n    }\n}\n","sourceCodeStart":66,"sourceCodeEnd":96,"githubUrl":"https://github.com/apereo/cas/blob/e7288fc434b4f4505b8452e1a57e8fb3111bb863/support/cas-server-support-oidc-federation/src/main/java/org/apereo/cas/oidc/federation/web/OidcFetchFederationEndpointController.java#L66-L96","documentation":"After locating the subordinate entity by ID, fetchEntityStatement() requires the subordinate's metadata payload to build the entity statement. If the loaded OidcFederationSubordinate has a null metadata field, this IllegalArgumentException is thrown indicating the subordinate definition is incomplete.","triggerScenarios":"The subordinate JSON file in the subordinate directory parses successfully but lacks the metadata property, and a client requests a fetch-entity statement for that entity ID.","commonSituations":"Hand-authored subordinate JSON missing the metadata block; schema change/version upgrade renamed or moved the metadata field so Jackson leaves it null; entity registered as a pure metadata placeholder.","solutions":["Add a valid metadata JSON object to the subordinate's JSON file in the subordinate directory and reload/restart","Verify the JSON field names match OidcFederationSubordinate's expected metadata property for the current CAS version","Validate each subordinate JSON against the model before deployment"],"exampleFix":"// before\n{ \"entityId\": \"https://op.example.org\" }\n// after\n{ \"entityId\": \"https://op.example.org\",\n  \"metadata\": { \"openid_provider\": { \"issuer\": \"https://op.example.org\", \"authorization_endpoint\": \"...\" } } }","handlingStrategy":"validation","validationCode":"val found = repository.findSubordinateByEntityId(entityId);\nif (found == null || found.getMetadata() == null) {\n    throw new IllegalStateException(\"Subordinate missing metadata: \" + entityId);\n}","typeGuard":null,"tryCatchPattern":"try {\n    return controller.fetchEntityStatement(sub, request, response);\n} catch (IllegalArgumentException e) {\n    return ResponseEntity.badRequest().body(Map.of(\"error\", \"invalid_request\", \"detail\", e.getMessage()));\n}","preventionTips":["Validate subordinate JSON files (metadata present) before deployment","Re-validate definitions after CAS version upgrades","Lint all entity files in CI"],"tags":["oidc-federation","data-integrity","configuration"],"backgroundTag":"missing-required-config-field","analyzedSha":"e7288fc434b4f4505b8452e1a57e8fb3111bb863","analyzedAt":"2026-09-08T15:39:16.015Z","contentChangedAt":"2026-09-08T15:39:16.015Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}