{"record":{"id":"a768766a5de77e52","repo":"apereo/cas","slug":"unable-to-create-folder","errorCode":null,"errorMessage":"Unable to create folder [{}]","messagePattern":"Unable to create folder \\[(.+?)\\]","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"core/cas-server-core-services/src/main/java/org/apereo/cas/config/CasServiceRegistryInitializationConfiguration.java","lineNumber":122,"sourceCode":"        }\n\n    }\n\n    @Configuration(value = \"CasServiceRegistryEmbeddedConfiguration\", proxyBeanMethods = false)\n    @EnableConfigurationProperties(CasConfigurationProperties.class)\n    static class CasServiceRegistryEmbeddedConfiguration {\n        private static Resource getServiceRegistryInitializerServicesDirectoryResource(\n            final CasConfigurationProperties casProperties,\n            final ConfigurableApplicationContext applicationContext) {\n            val registry = casProperties.getServiceRegistry().getJson();\n            if (ResourceUtils.doesResourceExist(registry.getLocation())\n                || (ResourceUtils.isJarResource(registry.getLocation()) && !registry.isUsingDefaultLocation())) {\n                LOGGER.debug(\"Using JSON service registry location [{}] for embedded service definitions\", registry.getLocation());\n                return registry.getLocation();\n            }\n            val parent = new File(FileUtils.getTempDirectory(), \"cas\");\n            if (!parent.mkdirs() && !parent.exists()) {\n                LOGGER.warn(\"Unable to create folder [{}]\", parent);\n            }\n            val baseName = FilenameUtils.getBaseName(registry.getLocation().getFilename());\n            val patterns = Arrays.stream(applicationContext.getEnvironment().getActiveProfiles())\n                .map(profile -> String.format(\"classpath*:/%s/%s/*.json\", baseName, profile))\n                .collect(Collectors.toList());\n\n            if (casProperties.getServiceRegistry().getCore().isInitDefaultServices()) {\n                patterns.add(\"classpath*:/services/*.json\");\n            }\n            LOGGER.debug(\"Patterns to scan for embedded service definitions: [{}]\", patterns);\n            ResourceUtils.exportResources(applicationContext, parent, patterns);\n            LOGGER.debug(\"Using service registry location [{}] for embedded service definitions\", parent);\n            return new FileSystemResource(parent);\n        }\n\n        @RefreshScope(proxyMode = ScopedProxyMode.DEFAULT)\n        @Bean\n        public ServiceRegistry embeddedJsonServiceRegistry(","sourceCodeStart":104,"sourceCodeEnd":140,"githubUrl":"https://github.com/apereo/cas/blob/e7288fc434b4f4505b8452e1a57e8fb3111bb863/core/cas-server-core-services/src/main/java/org/apereo/cas/config/CasServiceRegistryInitializationConfiguration.java#L104-L140","documentation":"CasServiceRegistryInitializationConfiguration.getServiceRegistryInitializerServicesDirectoryResource materializes embedded classpath service definitions to a temp directory (java.io.tmpdir/cas). If File.mkdirs() fails and the folder does not already exist, this warning is logged; startup continues but materializing default services may fail downstream.","triggerScenarios":"CAS startup with default/embedded JSON service registry location where new File(FileUtils.getTempDirectory(), \"cas\").mkdirs() fails — parent.mkdirs() returns false and parent.exists() is false; called via location() during the service registry initializer bean setup.","commonSituations":"Read-only or full tmp directory (readOnlyRootFilesystem in k8s, TMPDIR pointing to unwritable path); disk quota exceeded; restrictive permissions on java.io.tmpdir.","solutions":["Ensure the temp directory (java.io.tmpdir, typically /tmp) is writable by the CAS process user; set -Djava.io.tmpdir to a writable path if not.","Free disk space or raise the quota if tmpfs is full.","In containers, mount an writable emptyDir at /tmp or disable readOnlyRootFilesystem for the CAS container."],"exampleFix":"// before (k8s container)\nvolumes: []\n// after\nvolumes:\n  - name: tmp\n    emptyDir: {}\nvolumeMounts:\n  - name: tmp\n    mountPath: /tmp","handlingStrategy":"validation","validationCode":"// Startup pre-check\nFile tmp = new File(System.getProperty(\"java.io.tmpdir\"), \"cas\");\nif (!tmp.exists() && !tmp.mkdirs()) {\n    throw new IllegalStateException(\"Cannot create CAS temp dir: \" + tmp + \"; check java.io.tmpdir writability\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Ensure the container/CAS user can write to java.io.tmpdir; override -Djava.io.tmpdir if needed.","Mount writable tmp (emptyDir) in containers with readOnlyRootFilesystem.","Monitor disk space/quota on the tmp filesystem."],"tags":["filesystem","mkdir","startup","temp-directory"],"backgroundTag":"mkdir-permission-denied","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"}