{"record":{"id":"e92eff153ab803c3","repo":"apereo/cas","slug":"final-ticket-id-length-exceeds-char","errorCode":null,"errorMessage":"Final ticket id [{}] length [{}] exceeds [{}] characters","messagePattern":"Final ticket id \\[(.+?)\\] length \\[(.+?)\\] exceeds \\[(.+?)\\] characters","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"api/cas-server-core-api-ticket/src/main/java/org/apereo/cas/ticket/registry/TicketCompactor.java","lineNumber":104,"sourceCode":"     * @param ticketId the ticket id\n     * @return the common ticket structure\n     */\n    default CompactTicket parse(final String ticketId) {\n        val ticketElements = List.of(StringUtils.commaDelimitedListToStringArray(ticketId));\n        val creationTimeInSeconds = Instant.ofEpochSecond(Long.parseLong(ticketElements.get(CompactTicketIndexes.CREATION_TIME.getIndex())));\n        val expirationTimeInSeconds = Instant.ofEpochSecond(Long.parseLong(ticketElements.get(CompactTicketIndexes.EXPIRATION_TIME.getIndex())));\n        return new CompactTicket(ticketElements, creationTimeInSeconds, expirationTimeInSeconds);\n    }\n\n    /**\n     * Validate.\n     *\n     * @param finalTicket the final ticket\n     * @return the ticket\n     */\n    default Ticket validate(final EncodedTicket finalTicket) {\n        if (getMaximumTicketLength() > 0 && finalTicket.getId().length() >= getMaximumTicketLength()) {\n            LOGGER.warn(\"Final ticket id [{}] length [{}] exceeds [{}] characters\",\n                finalTicket.getId(), finalTicket.getId().length(), getMaximumTicketLength());\n        }\n        return finalTicket;\n    }\n\n    @RequiredArgsConstructor\n    @Getter\n    enum CompactTicketIndexes {\n        /**\n         * Represents the creation time of a compact ticket.\n         * The value of this variable is an integer that represents a specific time\n         * using a timestamp format.\n         */\n        CREATION_TIME(0),\n        /**\n         * Represents the expiration time of a compact ticket.\n         * The value of this variable is an integer that represents a specific time\n         * using a timestamp format.","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/apereo/cas/blob/e7288fc434b4f4505b8452e1a57e8fb3111bb863/api/cas-server-core-api-ticket/src/main/java/org/apereo/cas/ticket/registry/TicketCompactor.java#L86-L122","documentation":"TicketCompactor.validate inspects an EncodedTicket produced by ticket compression/compaction. If getMaximumTicketLength() is positive and the final (encoded) ticket id is at or above the maximum length, it warns that compaction did not shrink the id enough and returns the ticket unchanged. This flags tickets that may fail to round-trip through size-constrained transports (cookies, session stores, HTTP headers).","triggerScenarios":"A ticket registry/encoder produces an encoded ticket id whose length >= the configured maximum ticket length; e.g. very long service URLs or long cipher output inflating the encoded id beyond the limit.","commonSituations":"Oversized service parameters or long principal attributes making ticket ids huge; cipher/encoding settings producing long base64 payloads; maximumTicketLength configured too small for the deployment's ticket format.","solutions":["Raise the relevant maximum ticket length setting (e.g. cas.authn.ticket.tgt.max-length or the registry's getMaximumTicketLength source configuration) to accommodate encoded ids.","Reduce what goes into the ticket: shorten service URLs, move large attributes out of the ticket payload.","Review the ticket encoder/compression settings so encoded ids actually shrink below the limit.","Inspect the logged ticket length vs. the maximum to size the new limit precisely; remember the check is >= getMaximumTicketLength()."],"exampleFix":"// before\ncas.authn.ticket.tgt.max-length=256\n\n// after: accommodate encoded ticket ids\ncas.authn.ticket.tgt.max-length=512","handlingStrategy":"validation","validationCode":"if (maxTicketLength > 0 && encodedTicketId.length() >= maxTicketLength) {\n    throw new IllegalArgumentException(\"Encoded ticket id \" + encodedTicketId.length()\n        + \" exceeds max \" + maxTicketLength);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Size max-length settings against real encoded ticket lengths in your deployment.","Keep service URLs and embedded ticket payloads short.","Log and monitor ticket id lengths in staging before production rollout."],"tags":["tickets","length-limit","encoding","registry"],"backgroundTag":"value-out-of-range","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"}