{"record":{"id":"0c01bddf58823dcf","repo":"apereo/cas","slug":"configuration-file-must-be-specified","errorCode":null,"errorMessage":"Configuration file must be specified","messagePattern":"Configuration file must be specified","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"support/cas-server-support-shell-core/src/main/java/org/apereo/cas/shell/commands/properties/AddPropertiesToConfigurationCommand.java","lineNumber":50,"sourceCode":"     */\n    @Command(group = \"CAS Properties\", name = \"add-properties\", description = \"Add properties associated with a CAS group/module to a Properties/Yaml configuration file.\")\n    public void add(\n        @Option(\n            longName = \"file\",\n            description = \"Path to the CAS configuration file\",\n            defaultValue = \"/etc/cas/config/cas.properties\"\n        )\n        final String file,\n\n        @Option(\n            longName = \"group\",\n            description = \"Group/module whose associated settings should be added to the CAS configuration file\"\n        )\n        final String group\n    ) throws Exception {\n\n        if (StringUtils.isBlank(file)) {\n            LOGGER.warn(\"Configuration file must be specified\");\n            return;\n        }\n\n        val filePath = new File(file);\n        if (filePath.exists() && (filePath.isDirectory() || !filePath.canRead() || !filePath.canWrite())) {\n            LOGGER.warn(\"Configuration file [{}] is not readable/writable or is not a path to a file\", filePath.getCanonicalPath());\n            return;\n        }\n\n        val results = findProperties(group);\n        LOGGER.info(\"Located [{}] properties matching [{}]\", results.size(), group);\n\n        switch (FilenameUtils.getExtension(filePath.getName()).toLowerCase(Locale.ENGLISH)) {\n            case \"properties\" -> {\n                createConfigurationFileIfNeeded(filePath);\n                val props = loadPropertiesFromConfigurationFile(filePath);\n                writeConfigurationPropertiesToFile(filePath, results, props);\n            }","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/apereo/cas/blob/e7288fc434b4f4505b8452e1a57e8fb3111bb863/support/cas-server-support-shell-core/src/main/java/org/apereo/cas/shell/commands/properties/AddPropertiesToConfigurationCommand.java#L32-L68","documentation":"AddPropertiesToConfigurationCommand.add (CAS shell) adds properties/groups to a CAS configuration file given via --file. If the file parameter is blank, the command warns 'Configuration file must be specified' and returns without modifying anything.","triggerScenarios":"Running add-properties-to-configuration (or similar shell command) without the --file option, or with --file \"\" / whitespace.","commonSituations":"Forgetting the --file flag in scripts; relying on a default path that doesn't exist; invoking the command via a wrapper that drops empty arguments.","solutions":["Pass the path explicitly: --file /etc/cas/config/cas.properties.","If you intended the default config file, point --file at the running CAS configuration directory (spring.cloud.config.server.native.searchLocations).","Quote the argument in shell scripts to avoid it being dropped when empty."],"exampleFix":"// before\nadd-properties-to-configuration --group cas-server-core-authentication\n// after\nadd-properties-to-configuration --file /etc/cas/config/cas.properties --group cas-server-core-authentication","handlingStrategy":"validation","validationCode":"if (file == null || file.isBlank()) {\n    throw new IllegalArgumentException(\"--file is required: path to the CAS configuration file\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass --file /etc/cas/config/cas.properties explicitly in scripts.","Wrap empty-able arguments in quotes in shell wrappers.","Add a smoke test that invokes the command with a temp file to catch dropped flags."],"tags":["cli","configuration","properties"],"backgroundTag":"missing-required-flag","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"}