{"record":{"id":"53201bc51b07cf4a","repo":"apereo/cas","slug":"groovy-scripted-attribute-returned-no-value-for","errorCode":null,"errorMessage":"Groovy-scripted attribute returned no value for [{}]","messagePattern":"Groovy-scripted attribute returned no value for \\[(.+?)\\]","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"support/cas-server-support-ws-idp-api/src/main/java/org/apereo/cas/ws/idp/services/WSFederationClaimsReleasePolicy.java","lineNumber":153,"sourceCode":"                },\n                () -> {\n                    throw new RuntimeException(\"No groovy script cache manager is available to execute attribute mappings\");\n                });\n    }\n\n    private static void fetchAttributeValueFromScript(final ExecutableCompiledScript script,\n                                                      final String attributeName,\n                                                      final Map<String, List<Object>> resolvedAttributes,\n                                                      final Map<String, List<Object>> attributesToRelease) {\n        FunctionUtils.doUnchecked(_ -> {\n            val args = CollectionUtils.wrap(\"attributes\", resolvedAttributes, \"logger\", LOGGER);\n            script.setBinding(args);\n            val result = script.execute(args.values().toArray(), Object.class);\n            if (result != null) {\n                LOGGER.debug(\"Mapped attribute [{}] to [{}] from script\", attributeName, result);\n                attributesToRelease.put(attributeName, CollectionUtils.wrapList(result));\n            } else {\n                LOGGER.warn(\"Groovy-scripted attribute returned no value for [{}]\", attributeName);\n            }\n        });\n    }\n\n    @Override\n    public List<String> determineRequestedAttributeDefinitions(final RegisteredServiceAttributeReleasePolicyContext context) {\n        return new ArrayList<>(getAllowedAttributes().keySet());\n    }\n}\n","sourceCodeStart":135,"sourceCodeEnd":163,"githubUrl":"https://github.com/apereo/cas/blob/e7288fc434b4f4505b8452e1a57e8fb3111bb863/support/cas-server-support-ws-idp-api/src/main/java/org/apereo/cas/ws/idp/services/WSFederationClaimsReleasePolicy.java#L135-L163","documentation":"The WS-Federation release policy executes a Groovy script (inline or external file) to compute a claim value; the script ran but returned null, so no value could be mapped and the claim is skipped with this warning.","triggerScenarios":"fetchAttributeValueFromScript runs the Groovy script for the claim; script.execute(...) returns null for the given binding of principal/attributes/service.","commonSituations":"Script logic has a code path returning null for the user (missing attribute access); wrong attribute key accessed in the binding; external .groovy file deployed but written for a different attribute; syntax silently swallowing an error and returning null.","solutions":["Review the Groovy script and make it return a value (or a sane default) for all principals","Log inside the script to confirm the binding attributes it reads actually exist","Fix the attribute name the script reads to match the principal's attribute keys","If the claim is optional, treat the warning as benign; otherwise correct user data"],"exampleFix":"// before\ndef email = attributes['mail']; return null\n// after\ndef email = attributes?.getFirst('mail'); return email ?: \"unknown@example.invalid\"","handlingStrategy":"validation","validationCode":"// pre-check the script produces a non-null result for a sample user\nObject r = new GroovyShell().evaluate(scriptSource);\nif (r == null) LOGGER.warn(\"Script returns null\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Return a default value from the Groovy script instead of null","Bind/log the attributes the script reads and confirm they exist","Test scripts in a Groovy console with real attribute payloads before deploying"],"tags":["groovy","attribute-release","ws-federation"],"backgroundTag":"empty-result-set","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"}