{"record":{"id":"0a89a6b5d5a2431b","repo":"apereo/cas","slug":"no-ticket-granting-ticket-could-be-found-in-the-co","errorCode":null,"errorMessage":"No ticket-granting ticket could be found in the context","messagePattern":"No ticket-granting ticket could be found in the context","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"core/cas-server-core-web-api/src/main/java/org/apereo/cas/web/support/WebUtils.java","lineNumber":646,"sourceCode":"     * @param builder the builder\n     * @param ctx     the ctx\n     */\n    public static void putAuthenticationResultBuilder(final AuthenticationResultBuilder builder, final RequestContext ctx) {\n        ctx.getConversationScope().put(CasWebflowConstants.ATTRIBUTE_AUTHENTICATION_RESULT_BUILDER, builder);\n    }\n\n    /**\n     * Gets the authenticated principal.\n     *\n     * @param requestContext        the request context\n     * @param ticketRegistrySupport the ticket registry support\n     * @return the principal\n     */\n    public static Principal getPrincipalFromRequestContext(final RequestContext requestContext,\n                                                           final TicketRegistrySupport ticketRegistrySupport) {\n        val tgt = WebUtils.getTicketGrantingTicketId(requestContext);\n        if (StringUtils.isBlank(tgt)) {\n            throw new IllegalArgumentException(\"No ticket-granting ticket could be found in the context\");\n        }\n\n        return ticketRegistrySupport.getAuthenticatedPrincipalFrom(tgt);\n    }\n\n    /**\n     * Gets principal from request context.\n     *\n     * @param requestContext the request context\n     * @return the principal from request context\n     */\n    public static Principal getPrincipalFromRequestContext(final RequestContext requestContext) {\n        return requestContext.getFlowScope().get(\"principal\", Principal.class);\n    }\n\n    /**\n     * Gets authentication result builder.\n     *","sourceCodeStart":628,"sourceCodeEnd":664,"githubUrl":"https://github.com/apereo/cas/blob/e7288fc434b4f4505b8452e1a57e8fb3111bb863/core/cas-server-core-web-api/src/main/java/org/apereo/cas/web/support/WebUtils.java#L628-L664","documentation":"getPrincipalFromRequestContext requires a TGT id in the webflow request context, but none is present — the user has no active single-sign-on session at this point in the flow. IllegalArgumentException is a guard against proceeding to ticketRegistrySupport with a blank key. The input at fault is the missing TICKET_GRANTING_TICKET_ID flow/conversation attribute.","triggerScenarios":"Thrown at core/cas-server-core-web-api/src/main/java/org/apereo/cas/web/support/WebUtils.java:646 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the caller only invokes this after authentication/SSO established a TGT","Check that the TGT id is stored in the request context before this call (WebUtils.putTicketGrantingTicket...)","Handle unauthenticated flows by redirecting to login instead of fetching the principal"],"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"}