apereo/cas · warning
LoggingUtils.warn(LOGGER, e)
Error message
LoggingUtils.warn(LOGGER, e)
What it means
GitServiceRegistry.load() reads registered services from the git-backed repository. When any exception occurs (git I/O, corrupt repository, bad credentials), the service logs the exception via LoggingUtils.warn and falls back to listing the service-definition files directly from the repository directory, parsing them without git operations. The registry stays operational in degraded mode.
Solutions
- Inspect the warn-level stack trace from LoggingUtils to identify the underlying git failure (auth, lock, corruption)
- Remove stale lock files (.git/index.lock) and verify repository directory permissions
- Re-clone or repair the service-registry repository (git fsck / fresh clone at the configured directory)
- Validate remote credentials and network connectivity if the registry pulls from a remote
Example fix
// before // index.lock present, load fails and degrades // after rm -f /etc/cas/services/.git/index.lock git -C /etc/cas/services fsck
Defensive patterns
Strategy: fallback
Validate before calling
File gitDir = new File(repoDir, ".git");
if (!gitDir.exists() || new File(gitDir, "index.lock").exists()) {
LOGGER.warn("git repository unhealthy at {}", repoDir);
} Try / catch
try {
services = gitServiceRegistry.load();
} catch (Exception e) {
LOGGER.warn("git registry load failed, relying on degraded file parse", e);
} Prevention
- Monitor registry logs for the degraded-mode warn and alert on it
- Clean stale index.lock files and ensure the JVM exits cleanly
- Verify remote credentials and run git fsck after unclean shutdowns
When it happens
Trigger: load() throws internally: JGit cannot open the repository (missing .git dir, lock files, corrupt index), authentication to a remote fails, or a pull/fetch during load raises an Exception.
Common situations: Remote git repositories with expired credentials; leftover .git/index.lock after a crashed JVM; filesystem permission changes; network outage when the registry syncs with a remote.
Understand the failure class
Background: "git command failed": what it means when a tool shells out to git and git exits non-zero — this error's family across 21 libraries.
Related errors
- No registered service is found to match
- Custom theme [ ] for service [ ] cannot be located. Falling…
- The service definition file could not be saved at
- Metadata directory location cannot be located/created
- Unauthorized
AI-assisted analysis of apereo/cas@e7288fc434 (2026-09-08).
Data as JSON: /api/errors/d4735effd3febd92.
Report an issue: GitHub.
Appendix: source
Thrown at support/cas-server-support-git-service-registry/src/main/java/org/apereo/cas/services/GitServiceRegistry.java:132
LOGGER.info("Unable to pull changes from the remote repository. Service definition files may be stale.");
}
val objectPatternStr = StringUtils.isBlank(rootDirectory)
? GitRepositoryRegisteredServiceLocator.PATTEN_ACCEPTED_REPOSITORY_FILES
: rootDirectory + '/' + GitRepositoryRegisteredServiceLocator.PATTEN_ACCEPTED_REPOSITORY_FILES;
val objectPattern = RegexUtils.createPattern(objectPatternStr, Pattern.CASE_INSENSITIVE);
val objects = gitRepository.getObjectsInRepository(
new PathRegexPatternTreeFilter(objectPattern));
registeredServices = objects
.stream()
.filter(Objects::nonNull)
.map(this::parseGitObjectContentIntoRegisteredService)
.flatMap(Collection::stream)
.map(this::invokeServiceRegistryListenerPostLoad)
.filter(Objects::nonNull)
.collect(Collectors.toList());
return registeredServices;
} catch (final Exception e) {
LoggingUtils.warn(LOGGER, e);
val parentDir = StringUtils.isBlank(rootDirectory)
? gitRepository.getRepositoryDirectory()
: new File(gitRepository.getRepositoryDirectory(), rootDirectory);
val files = FileUtils.listFiles(parentDir,
GitRepositoryRegisteredServiceLocator.FILE_EXTENSIONS.toArray(ArrayUtils.EMPTY_STRING_ARRAY), true);
LOGGER.debug("Located [{}] files(s)", files.size());
registeredServices = files
.stream()
.filter(file -> file.isFile() && file.canRead() && file.canWrite() && file.length() > 0)
.map(Unchecked.function(file -> {
try (val in = Files.newBufferedReader(file.toPath())) {
return registeredServiceSerializers
.stream()
.filter(s -> s.supports(file))
.map(s -> s.load(in))
.filter(Objects::nonNull)
.flatMap(Collection::stream)View on GitHub (pinned to e7288fc434)