apereo/cas · error · IllegalArgumentException

Provided location does not exist and is empty

Error message

Provided location does not exist and is empty

What it means

Generic input guard in resource resolution: getRawResourceFrom(location) was called with a null or blank location string. No resource can be constructed from an empty location, so IllegalArgumentException is thrown before any URL/classpath/file logic runs. The input at fault is the location string.

Solutions

  1. Supply a non-empty location (classpath:, file:, http(s) URL, or filesystem path)
  2. Check the configuration property that feeds this location — it is unset or empty
  3. Guard callers with ResourceUtils.doesResourceExist or blank checks when location is optional
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/ResourceUtils.java:63 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of apereo/cas@e7288fc434 (2026-09-08). Data as JSON: /api/errors/baf25ba2b8c8443d. Report an issue: GitHub.

Appendix: source

Thrown at core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/ResourceUtils.java:63

    /**
     * Null unknown resource.
     */
    public static final Resource NULL_RESOURCE = new DescriptiveResource("Unknown Resource");

    private static final String HTTP_URL_PREFIX = "http";
    private static final String RESOURCE_URL_PREFIX = "resource:";

    /**
     * Gets resource from a String location.
     *
     * @param location the metadata location
     * @return the resource from
     * @throws IOException the exception
     */
    public static AbstractResource getRawResourceFrom(final @Nullable String location) throws IOException {
        if (StringUtils.isBlank(location)) {
            throw new IllegalArgumentException("Provided location does not exist and is empty");
        }
        if (isUrl(location)) {
            return new UrlResource(location);
        }
        if (isClasspathResource(location)) {
            return new ClassPathResource(location.substring(CLASSPATH_URL_PREFIX.length()));
        }
        return new FileSystemResource(Strings.CI.remove(location, FILE_URL_PREFIX));
    }

    /**
     * Is classpath resource?.
     *
     * @param location the location
     * @return true/false
     */
    public static boolean isClasspathResource(final String location) {
        return StringUtils.isNotBlank(location) && location.toLowerCase(Locale.ENGLISH).startsWith(CLASSPATH_URL_PREFIX);

View on GitHub (pinned to e7288fc434)