{"record":{"id":"ac4858cc6fec3b80","repo":"apereo/cas","slug":"no-groovy-script-cache-manager-is-available-to-exe","errorCode":null,"errorMessage":"No groovy script cache manager is available to execute attribute mappings","messagePattern":"No groovy script cache manager is available to execute attribute mappings","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"support/cas-server-support-ws-idp-api/src/main/java/org/apereo/cas/ws/idp/services/WSFederationClaimsReleasePolicy.java","lineNumber":122,"sourceCode":"            }\n        }\n        mapSimpleSingleAttributeDefinition(attributeName, mappedAttributeName, attributeValue, attributesToRelease);\n    }\n\n    private static void fetchAttributeValueFromExternalGroovyScript(final String attributeName,\n                                                                    final Map<String, List<Object>> resolvedAttributes,\n                                                                    final Map<String, List<Object>> attributesToRelease,\n                                                                    final String file) {\n\n        ApplicationContextProvider.getScriptResourceCacheManager().ifPresentOrElse(\n            cacheMgr -> {\n                val script = cacheMgr.resolveScriptableResource(file, attributeName, file);\n                if (script != null) {\n                    fetchAttributeValueFromScript(script, attributeName, resolvedAttributes, attributesToRelease);\n                }\n            },\n            () -> {\n                throw new RuntimeException(\"No groovy script cache manager is available to execute attribute mappings\");\n            });\n    }\n\n    private static void fetchAttributeValueAsInlineGroovyScript(final String attributeName,\n                                                                final Map<String, List<Object>> resolvedAttributes,\n                                                                final Map<String, List<Object>> attributesToRelease,\n                                                                final String inlineGroovy) {\n        ApplicationContextProvider.getScriptResourceCacheManager()\n            .ifPresentOrElse(\n                cacheMgr -> {\n                    val script = cacheMgr.resolveScriptableResource(inlineGroovy, attributeName, inlineGroovy);\n                    fetchAttributeValueFromScript(script, attributeName, resolvedAttributes, attributesToRelease);\n                },\n                () -> {\n                    throw new RuntimeException(\"No groovy script cache manager is available to execute attribute mappings\");\n                });\n    }\n","sourceCodeStart":104,"sourceCodeEnd":140,"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#L104-L140","documentation":"WSFederationClaimsReleasePolicy tries to execute an external Groovy script file to map/release an attribute. It resolves the script through a Groovy script cache manager; when no cache manager is configured/available, the Optional is empty and the policy throws RuntimeException('No groovy script cache manager is available to execute attribute mappings').","triggerScenarios":"Mapping an attribute definition whose release policy points to an external Groovy script file (file-based groovy mapping) while the application context lacks a Groovy resource cache manager bean, so cacheMgr is absent when fetchAttributeValueFromExternalGroovyScript runs.","commonSituations":"WS-Federation relying-party configuration uses groovy-file attribute mappings but the module/config that supplies the script cache manager (script resource locator/cacheManager bean) is not present; running a minimal/custom CAS overlay missing the groovy scripting support wiring; wrong bean removal in a custom Spring configuration override.","solutions":["Ensure the Groovy scripting support configuration is loaded so a script cache manager bean is registered in the application context (include the relevant groovy/core scripting module in the overlay)","If you override CAS Spring configuration, do not exclude/replace the bean that provides the groovy script cache manager","Alternatively, switch the attribute mapping away from external Groovy files to inline groovy/static mappings if no scripting support is desired","Verify with a debug breakpoint/log that the Optional cacheMgr in the policy resolves non-null at runtime"],"exampleFix":"// before: no cache manager in context, policy throws\nval policy = new WSFederationClaimsReleasePolicy(applicationContext, attributes); // groovy file mapping fails\n// after: make sure scripting config is imported, e.g. in custom autoconfiguration\n@Import(CasGroovyScriptCacheManagerConfiguration.class)\npublic class WsIdpConfig { ... }","handlingStrategy":"validation","validationCode":"var cacheMgr = applicationContext.getBeanProvider(GroovyScriptResourceCacheManager.class)\n    .getIfAvailable();\nif (cacheMgr == null) {\n    throw new IllegalStateException(\"Groovy script cache manager missing; enable scripting support before using groovy file attribute mappings\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    attributes = policy.getAttributes(releasePolicyContext);\n} catch (RuntimeException e) {\n    if (e.getMessage().contains(\"No groovy script cache manager\")) {\n        // fall back to static attribute release or fail fast with config guidance\n    }\n}","preventionTips":["Include the groovy scripting module/config in every overlay that uses groovy-based attribute mappings","Re-verify custom @Configuration overrides after CAS upgrades","Smoke-test WS-Federation attribute release in staging after dependency changes","Prefer inline/static mappings when scripting support is intentionally absent"],"tags":["groovy","ws-federation","attribute-release","missing-dependency"],"backgroundTag":"missing-dependency","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"}