apereo/cas · warning

Configuration file format

Error message

Configuration file format [{}] is not recognized

What it means

AddPropertiesToConfigurationCommand.add() switches on the configuration file extension and only supports 'properties' and 'yaml'/'yml'. Any other extension falls into the default branch and the command logs this warning and skips writing the located properties. No exception is thrown; the properties are simply not added.

Solutions

  1. Rename or copy the target so its extension is .properties, .yaml, or .yml
  2. Convert the configuration content to a supported properties or YAML format
  3. Verify the --file argument points at the intended file (check the logged canonical path)
  4. If using a backup file, restore the original extension before running the command

Example fix

// before
cas add-properties-to-configuration --file /etc/cas/config/application.conf ...
// after
cas add-properties-to-configuration --file /etc/cas/config/application.properties ...
Defensive patterns

Strategy: validation

Validate before calling

String name = file.getName().toLowerCase();
boolean supported = name.endsWith(".properties") || name.endsWith(".yaml") || name.endsWith(".yml");
if (!supported) throw new IllegalArgumentException("Unsupported config format: " + name);

Prevention

When it happens

Trigger: Running 'cas add-properties-to-configuration --file <path>' where the target file has an extension other than .properties, .yaml, or .yml (e.g. .conf, .json, or no extension).

Common situations: Using a .json or .env config file; targeting a file with no extension; typo in the filename extension (.prop, .yam); copying a template with a backup extension (.properties.bak).

Related errors


AI-assisted analysis of apereo/cas@e7288fc434 (2026-09-08). Data as JSON: /api/errors/b9943550c9df62e2. 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:74

            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);
            }
            case "yaml", "yml" -> {
                createConfigurationFileIfNeeded(filePath);
                val yamlProps = CasCoreConfigurationUtils.loadYamlProperties(new FileSystemResource(filePath));
                writeYamlConfigurationPropertiesToFile(filePath, results, yamlProps);
            }
            default -> LOGGER.warn("Configuration file format [{}] is not recognized", filePath.getCanonicalPath());
        }

    }

    private static void writeYamlConfigurationPropertiesToFile(final File filePath,
                                                               final Map<String, ConfigurationMetadataProperty> results,
                                                               final Map<String, Object> yamlProps) throws Exception {
        val options = new DumperOptions();
        options.setDefaultFlowStyle(DumperOptions.FlowStyle.AUTO);
        options.setDefaultScalarStyle(DumperOptions.ScalarStyle.PLAIN);
        options.setPrettyFlow(true);
        options.setAllowUnicode(true);
        val yaml = new Yaml(options);
        try (val writer = Files.newBufferedWriter(filePath.toPath(), StandardCharsets.UTF_8)) {
            putResultsIntoProperties(results, yamlProps);
            yaml.dump(yamlProps, writer);
        }
    }

View on GitHub (pinned to e7288fc434)