{"record":{"id":"38ccde07f6c420a9","repo":"iflytek/astron-agent","slug":"failed-to-parse-user-id-from-pre-binding-information-appid","errorCode":null,"errorMessage":"Failed to parse user ID from pre-binding information: appid={}, preBindInfo={}","messagePattern":"Failed to parse user ID from pre-binding information: appid=(.+?), preBindInfo=(.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"console/backend/hub/src/main/java/com/iflytek/astron/console/hub/service/wechat/impl/WechatThirdpartyServiceImpl.java","lineNumber":269,"sourceCode":"    }\n\n    /**\n     * Get user ID from pre-binding information\n     */\n    private String getUidFromPreBindInfo(String appid, Integer botId) {\n        String preBindKey = PRE_BIND_KEY + appid;\n        RBucket<String> bucket = redissonClient.getBucket(preBindKey);\n\n        if (bucket.isExists()) {\n            String preBindInfo = bucket.get();\n            try {\n                // Parse botId:uid format\n                String[] parts = preBindInfo.split(\":\");\n                if (parts.length >= 2) {\n                    return parts[1];\n                }\n            } catch (Exception e) {\n                log.warn(\"Failed to parse user ID from pre-binding information: appid={}, preBindInfo={}\", appid, preBindInfo, e);\n            }\n        }\n\n        log.warn(\"Pre-binding user ID not found: appid={}, botId={}\", appid, botId);\n        return null;\n    }\n\n    /**\n     * Clean up pre-binding cache\n     */\n    private void cleanupPreBindCache(String appid, Integer botId) {\n        // Clean up pre-binding status\n        String preBindKey = PRE_BIND_KEY + appid;\n        redissonClient.getBucket(preBindKey).delete();\n\n        // Clean up pre-authorization code\n        String preAuthCodeKey = PRE_AUTH_CODE_KEY + botId;\n        redissonClient.getBucket(preAuthCodeKey).delete();","sourceCodeStart":251,"sourceCodeEnd":287,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/console/backend/hub/src/main/java/com/iflytek/astron/console/hub/service/wechat/impl/WechatThirdpartyServiceImpl.java#L251-L287","documentation":"WARN inside getUidFromPreBindInfo: the pre-binding cache value (expected format \"botId:uid\") could not be parsed to extract the uid — either it split into fewer than 2 parts or splitting threw. The method then logs 'Pre-binding user ID not found' and returns null.","triggerScenarios":"Redis pre-bind key contains malformed data (not 'botId:uid', e.g. only botId, empty value, or unexpected delimiter) when the WeChat bind callback resolves the uid.","commonSituations":"Pre-bind entries written by an older version with a different format; cache corruption or manual cache edits; expired/partially flushed cache entries.","solutions":["Inspect the pre-bind cache value for that appid and fix or delete the malformed entry, then retry the bind.","Validate the stored format when writing pre-bind info (regex ^[^:]+:[^:]+$) to prevent corrupt entries.","Return an explicit error in the bind callback when uid is null instead of proceeding with null uid."],"exampleFix":"// before\nString[] parts = preBindInfo.split(\":\");\nif (parts.length >= 2) { return parts[1]; }\n// after\nString[] parts = preBindInfo.split(\":\", 2);\nif (parts.length == 2 && StringUtils.isNotBlank(parts[1])) { return parts[1]; }\nlog.warn(\"Malformed preBindInfo, expected botId:uid: {}\", preBindInfo);","handlingStrategy":"type-guard","validationCode":"boolean validPreBind = preBindInfo != null && preBindInfo.matches(\"[^:]+:[^:]+\");","typeGuard":"static boolean hasUid(String preBindInfo) {\n    if (preBindInfo == null) return false;\n    String[] p = preBindInfo.split(\":\", 2);\n    return p.length == 2 && !p[1].isBlank();\n}","tryCatchPattern":null,"preventionTips":["Write pre-bind cache entries in a fixed botId:uid format and validate on write.","Delete malformed cache entries instead of parsing them repeatedly.","Version the cache key format when the layout changes across releases."],"tags":["wechat","cache","parsing","pre-bind"],"backgroundTag":"invalid-argument-format","analyzedSha":"5e758547a83371a5a4b29dadf4ac03e8dd527635","analyzedAt":"2026-09-12T08:03:51.356Z","contentChangedAt":"2026-09-12T08:03:51.356Z","schemaVersion":2},"datasetVersion":"2026-09-19T12:17:13.211Z"}