apereo/cas · warning
Metadata artifacts are available at the specified location
Error message
Metadata artifacts are available at the specified location [{}] What it means
GenerateSamlIdPMetadataCommand.generate() checks whether metadata artifacts already exist at the target location via the metadata locator. If they already exist it logs this warning; generation only proceeds when --force is supplied (or the location is empty). This prevents silently overwriting an existing IdP metadata keystore/certificates.
Solutions
- Add --force to regenerate and overwrite the existing metadata artifacts
- Use a different --metadataLocation for a fresh generation
- Verify existing metadata is backed up before forcing regeneration
- If artifacts are current, do nothing — generation is intentionally skipped
Example fix
// before cas generate-saml-idp-metadata --metadataLocation /etc/cas/saml/idp // after cas generate-saml-idp-metadata --metadataLocation /etc/cas/saml/idp --force
Defensive patterns
Strategy: validation
Validate before calling
File dir = new File(metadataLocation);
boolean exists = dir.exists() && new File(dir, "idp-metadata.xml").exists(); // or run the locator check
if (exists && !force) System.out.println("Metadata already present; pass --force to regenerate"); Prevention
- Use unique metadata locations per environment to avoid accidental overwrites
- Back up the metadata directory before using --force
- Make generation scripts idempotent by checking the locator first
When it happens
Trigger: Running 'cas generate-saml-idp-metadata' (or the equivalent shell command) with --metadataLocation pointing at a directory that already contains IdP metadata artifacts, without --force.
Common situations: Re-running the metadata generation command after a previous successful run; pointing at a directory already populated by the IdP; scripted re-provisioning that reuses the same metadata directory.
Understand the failure class
Background: "already exists" / EEXIST / FileAlreadyExistsException: what the 'file already exists' error means and how to fix it — this error's family across 37 libraries.
Related errors
- No assertion consumer service could be found for entity
- Endpoint for is not available or does not define a binding…
- Endpoint for does not define a binding or location for…
- Metadata directory location cannot be located/created
- Multiple S3 objects where found in bucket
AI-assisted analysis of apereo/cas@e7288fc434 (2026-09-08).
Data as JSON: /api/errors/c5edb39aa51544ae.
Report an issue: GitHub.
Appendix: source
Thrown at support/cas-server-support-shell-core/src/main/java/org/apereo/cas/shell/commands/saml/GenerateSamlIdPMetadataCommand.java:110
description = "Comma separated list of other subject alternative names for the certificate (besides entityId)",
defaultValue = StringUtils.EMPTY
)
final String subjectAltNames
) throws Throwable {
val locator = new FileSystemSamlIdPMetadataLocator(CipherExecutor.noOpOfStringToString(),
new File(metadataLocation),
Caffeine.newBuilder().initialCapacity(1).maximumSize(1).build(),
applicationContext);
val writer = new DefaultSamlIdPCertificateAndKeyWriter(entityId);
if (StringUtils.isNotBlank(subjectAltNames)) {
writer.setUriSubjectAltNames(List.of(StringUtils.split(subjectAltNames, ",")));
}
val generateMetadata = FunctionUtils.doIf(locator.exists(Optional.empty()),
() -> Boolean.TRUE,
() -> {
LOGGER.warn("Metadata artifacts are available at the specified location [{}]", metadataLocation);
return force;
}).get();
if (generateMetadata) {
val props = new CasConfigurationProperties();
props.getAuthn().getSamlIdp().getCore().setEntityId(entityId);
props.getServer().setScope(scope);
props.getServer().setPrefix(serverPrefix);
val context = SamlIdPMetadataGeneratorConfigurationContext.builder()
.samlIdPMetadataLocator(locator)
.samlIdPCertificateAndKeyWriter(writer)
.applicationContext(applicationContext)
.casProperties(props)
.metadataCipherExecutor(CipherExecutor.noOpOfStringToString())
.openSamlConfigBean(openSamlConfigBean)
.velocityEngine(velocityEngineFactoryBean)
.build();View on GitHub (pinned to e7288fc434)