{"record":{"id":"ff7bb476dfbe398b","repo":"apereo/cas","slug":"invalid-cookie-name-required-fields-are-missing","errorCode":null,"errorMessage":"Invalid cookie <name>. Required fields are missing","messagePattern":"Invalid cookie <name>\\. Required fields are missing","errorType":"exception","errorClass":"InvalidCookieException","httpStatus":null,"severity":"error","filePath":"core/cas-server-core-cookie-api/src/main/java/org/apereo/cas/web/support/mgmr/DefaultCasCookieValueManager.java","lineNumber":105,"sourceCode":"                return clientInfo.getClientIpAddress();\n            })\n            .filter(Objects::nonNull)\n            .findFirst()\n            .orElseGet(clientInfo::getClientIpAddress);\n    }\n\n    @Override\n    protected String obtainValueFromCompoundCookie(final String value, final HttpServletRequest request) {\n        val cookieParts = Splitter.on(String.valueOf(COOKIE_FIELD_SEPARATOR)).splitToList(value);\n\n        val cookieValue = cookieParts.getFirst();\n        if (!cookieProperties.isPinToSession()) {\n            LOGGER.trace(\"Cookie session-pinning is disabled for cookie [{}]. Returning cookie value as it was provided\", cookieProperties.getName());\n            return cookieValue;\n        }\n\n        if (cookieParts.size() != COOKIE_FIELDS_LENGTH) {\n            throw new InvalidCookieException(\"Invalid cookie %s. Required fields are missing\".formatted(cookieProperties.getName()));\n        }\n        val cookieClientLocationOrIp = cookieParts.get(1);\n        val cookieUserAgent = cookieParts.get(2);\n\n        if (Stream.of(cookieValue, cookieClientLocationOrIp, cookieUserAgent).anyMatch(StringUtils::isBlank)) {\n            throw new InvalidCookieException(\"Invalid cookie %s. Required fields are empty\".formatted(cookieProperties.getName()));\n        }\n\n        val clientInfo = ClientInfoHolder.getClientInfo();\n        if (clientInfo == null) {\n            val message = \"Unable to match required remote address %s because client ip at time of cookie creation is unknown for cookie %s\"\n                .formatted(cookieProperties.getName(), cookieClientLocationOrIp);\n            LOGGER.warn(message);\n            throw new InvalidCookieException(message);\n        }\n\n        if (cookieProperties.isGeoLocateClientSession()) {\n            val clientLocationOrIp = getClientGeoLocation(clientInfo);","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/apereo/cas/blob/e7288fc434b4f4505b8452e1a57e8fb3111bb863/core/cas-server-core-cookie-api/src/main/java/org/apereo/cas/web/support/mgmr/DefaultCasCookieValueManager.java#L87-L123","documentation":"While reading a compound cookie, the split value did not contain the expected number of fields (cookieParts.size() != COOKIE_FIELDS_LENGTH), so required parts (value, client location/IP, user-agent) are missing. InvalidCookieException signals a malformed or truncated cookie — usually a stale cookie from an older format, manual tampering, or corruption in transit.","triggerScenarios":"Thrown at core/cas-server-core-cookie-api/src/main/java/org/apereo/cas/web/support/mgmr/DefaultCasCookieValueManager.java:105 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Clear the browser cookie for the CAS domain and re-authenticate","Check whether the cookie format/field count changed across CAS upgrades and invalidate old cookies","Ensure no proxy or middleware truncates or rewrites the cookie value"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e7288fc434b4f4505b8452e1a57e8fb3111bb863","analyzedAt":"2026-09-08T15:39:16.015Z","contentChangedAt":"2026-09-08T15:39:16.015Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}