{"record":{"id":"8ed31bcc2687e1a7","repo":"iflytek/astron-agent","slug":"login-info-error","errorCode":"LOGIN_INFO_ERROR","errorMessage":"LOGIN_INFO_ERROR","messagePattern":"LOGIN_INFO_ERROR","errorType":"error_code","errorClass":"BusinessException","httpStatus":null,"severity":"error","filePath":"console/backend/hub/src/main/java/com/iflytek/astron/console/hub/controller/chat/ChatMessageController.java","lineNumber":456,"sourceCode":"                    new ChatContext(uid, 0L, debugRequest.getBotId() == null ? 0 : debugRequest.getBotId()));\n            botChatService.debugChatMessageBot(debugChatReqDto, sseEmitter, sseId);\n            return sseEmitter;\n        } catch (Exception e) {\n            log.error(\"Bot debug error, sseId: {}\", sseId, e);\n            SseEmitterUtil.completeWithError(sseEmitter, \"Chat service exception: \" + e.getMessage());\n            return sseEmitter;\n        }\n    }\n\n    /**\n     * Clear chat history\n     */\n    @GetMapping(path = \"/clear\")\n    @Operation(summary = \"Clear chat history\")\n    public ApiResult<ChatListCreateResponse> clear(Integer botId, Long chatId) {\n        String uid = RequestContextUtil.getUID();\n        if (uid == null) {\n            throw new BusinessException(ResponseEnum.LOGIN_INFO_ERROR);\n        }\n        if (chatId == null) {\n            throw new BusinessException(ResponseEnum.PARAMS_ERROR);\n        }\n        ChatBotBase botBase = chatBotDataService.findById(botId).orElse(null);\n        if (botBase == null) {\n            throw new BusinessException(ResponseEnum.PARAMS_ERROR);\n        }\n        return ApiResult.success(botChatService.clear(chatId, uid, botId, botBase));\n    }\n}\n","sourceCodeStart":438,"sourceCodeEnd":468,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/console/backend/hub/src/main/java/com/iflytek/astron/console/hub/controller/chat/ChatMessageController.java#L438-L468","documentation":"LOGIN_INFO_ERROR is thrown by ChatMessageController.clear when RequestContextUtil.getUID() returns null, meaning the request lacks valid login/session info from which a uid can be resolved. The endpoint cannot attribute or authorize the history clear without an authenticated user.","triggerScenarios":"GET /clear without authentication credentials or with an expired/invalid token so the auth filter never populated the request context; calling the endpoint from a non-authenticated context (internal job, curl without token).","commonSituations":"JWT/session expired mid-use; missing Authorization header; token format changed after an auth upgrade; direct API testing without going through the login flow.","solutions":["Re-authenticate to obtain a fresh token and retry","Ensure the Authorization/session header is present on the request","Verify the auth filter/interceptor covers the /clear route and populates the UID","Clear stale client credentials and log in again"],"exampleFix":"// before\ncurl \"http://host/v1/clear?botId=1&chatId=2\"  // 401-ish LOGIN_INFO_ERROR\n// after\ncurl -H \"Authorization: Bearer $TOKEN\" \"http://host/v1/clear?botId=1&chatId=2\"","handlingStrategy":"try-catch","validationCode":"if (!authToken) throw new Error('login required before clearing chat history');","typeGuard":"const isAuthenticated = (ctx) => Boolean(ctx && ctx.uid);","tryCatchPattern":"try { await clearHistory(botId, chatId); } catch (e) { if (e.code === 'LOGIN_INFO_ERROR') { redirectToLogin(); } else throw e; }","preventionTips":["Attach the Authorization header via a shared HTTP client interceptor","Handle token expiry globally with a refresh/re-login flow","Never call authenticated endpoints from unauthenticated contexts","Add a 401/login interceptor that maps to LOGIN_INFO_ERROR handling"],"tags":["authentication","session","login"],"backgroundTag":"authentication-required","analyzedSha":"5e758547a83371a5a4b29dadf4ac03e8dd527635","analyzedAt":"2026-09-12T08:03:51.356Z","contentChangedAt":"2026-09-12T08:03:51.356Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}