{"record":{"id":"478fe3b601355c83","repo":"apereo/cas","slug":"file-is-does-not-exist-is-not-readable-or-is","errorCode":null,"errorMessage":"File [{}] is does not exist, is not readable or is empty","messagePattern":"File \\[(.+?)\\] is does not exist, is not readable or is empty","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"support/cas-server-support-shell-core/src/main/java/org/apereo/cas/shell/commands/services/GenerateYamlRegisteredServiceCommand.java","lineNumber":74,"sourceCode":"        try {\n            val validator = new RegisteredServiceJsonSerializer(applicationContext);\n            val basicFileAttributes = Files.readAttributes(filePath.toPath(), BasicFileAttributes.class);\n            if (basicFileAttributes.isRegularFile() && filePath.exists()\n                && filePath.canRead() && basicFileAttributes.size() > 0) {\n                val svc = validator.from(filePath);\n                LOGGER.info(\"Service [{}] is valid at [{}].\", svc.getName(), filePath.getCanonicalPath());\n                val yaml = new RegisteredServiceYamlSerializer(applicationContext);\n                try (val writer = new StringWriter()) {\n                    yaml.to(writer, svc);\n                    LOGGER.info(writer.toString());\n\n                    if (result != null) {\n                        yaml.to(result, svc);\n                        LOGGER.info(\"YAML service definition is saved at [{}].\", result.getCanonicalPath());\n                    }\n                }\n            } else {\n                LOGGER.warn(\"File [{}] is does not exist, is not readable or is empty\", filePath.getCanonicalPath());\n            }\n        } catch (final Exception e) {\n            LOGGER.error(\"Could not understand and validate [{}]: [{}]\", filePath.getPath(), e.getMessage());\n        } finally {\n            LOGGER.info(\"-\".repeat(SEP_LINE_LENGTH));\n        }\n\n    }\n}\n","sourceCodeStart":56,"sourceCodeEnd":84,"githubUrl":"https://github.com/apereo/cas/blob/e7288fc434b4f4505b8452e1a57e8fb3111bb863/support/cas-server-support-shell-core/src/main/java/org/apereo/cas/shell/commands/services/GenerateYamlRegisteredServiceCommand.java#L56-L84","documentation":"GenerateYamlRegisteredServiceCommand logs this warning when the JSON service definition file passed to generateYaml does not exist, is unreadable, or is empty, so there is nothing to convert to YAML. The command catches any conversion error, logs it, and finishes without producing the YAML output.","triggerScenarios":"Running 'cas generate-yaml-registered-service' with --file pointing at a path that does not exist, has no read permission, or is a zero-byte file.","commonSituations":"Typo in the JSON service file path; relative path resolved from a different working directory; truncated/empty file from a failed copy or download; file created but serializer never wrote content.","solutions":["Pass the correct absolute path to an existing JSON registered service file","Verify the file is non-empty and readable (cat / ls -l the path)","Check the current working directory when using relative paths","Re-create or re-copy the JSON service definition if it is truncated"],"exampleFix":"// before\ncas generate-yaml-registered-service --file svc.json\n// after\ncas generate-yaml-registered-service --file /etc/cas/services/Example-1000.json","handlingStrategy":"validation","validationCode":"File f = new File(path);\nif (!f.isFile() || !f.canRead() || f.length() == 0)\n    throw new IllegalArgumentException(\"Service JSON file missing/empty/unreadable: \" + path);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use absolute paths in scripts regardless of working directory","Verify file size > 0 after copy/download before conversion","Fix permissions on the services directory for the shell user"],"tags":["filesystem","cli","registered-services","yaml"],"backgroundTag":"file-not-found","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"}