apereo/cas · warning
Configuration file must be specified
Error message
Configuration file must be specified
What it means
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.
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.
Example fix
// before add-properties-to-configuration --group cas-server-core-authentication // after add-properties-to-configuration --file /etc/cas/config/cas.properties --group cas-server-core-authentication
Defensive patterns
Strategy: validation
Validate before calling
if (file == null || file.isBlank()) {
throw new IllegalArgumentException("--file is required: path to the CAS configuration file");
} Prevention
- 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.
When it happens
Trigger: Running add-properties-to-configuration (or similar shell command) without the --file option, or with --file "" / whitespace.
Common situations: 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.
Understand the failure class
Background: "--flag is required" and "must specify" CLI errors: how missing-required-flag validation works and how to fix it — this error's family across 20 libraries.
Related errors
- Configuration file [ ] is not readable/writable or is not a…
- Configuration file format
- No user can be accepted because none is defined
- Not all requested multifactor providers could be found…
- Cookie name is undefined
AI-assisted analysis of apereo/cas@e7288fc434 (2026-09-08).
Data as JSON: /api/errors/0c01bddf58823dcf.
Report an issue: GitHub.
Appendix: source
Thrown at support/cas-server-support-shell-core/src/main/java/org/apereo/cas/shell/commands/properties/AddPropertiesToConfigurationCommand.java:50
*/
@Command(group = "CAS Properties", name = "add-properties", description = "Add properties associated with a CAS group/module to a Properties/Yaml configuration file.")
public void add(
@Option(
longName = "file",
description = "Path to the CAS configuration file",
defaultValue = "/etc/cas/config/cas.properties"
)
final String file,
@Option(
longName = "group",
description = "Group/module whose associated settings should be added to the CAS configuration file"
)
final String group
) throws Exception {
if (StringUtils.isBlank(file)) {
LOGGER.warn("Configuration file must be specified");
return;
}
val filePath = new File(file);
if (filePath.exists() && (filePath.isDirectory() || !filePath.canRead() || !filePath.canWrite())) {
LOGGER.warn("Configuration file [{}] is not readable/writable or is not a path to a file", filePath.getCanonicalPath());
return;
}
val results = findProperties(group);
LOGGER.info("Located [{}] properties matching [{}]", results.size(), group);
switch (FilenameUtils.getExtension(filePath.getName()).toLowerCase(Locale.ENGLISH)) {
case "properties" -> {
createConfigurationFileIfNeeded(filePath);
val props = loadPropertiesFromConfigurationFile(filePath);
writeConfigurationPropertiesToFile(filePath, results, props);
}View on GitHub (pinned to e7288fc434)