iflytek/astron-agent · warning
Failed to parse user ID from pre-binding information: appid=
Error message
Failed to parse user ID from pre-binding information: appid={}, preBindInfo={} What it means
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.
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.
Example fix
// before
String[] parts = preBindInfo.split(":");
if (parts.length >= 2) { return parts[1]; }
// after
String[] parts = preBindInfo.split(":", 2);
if (parts.length == 2 && StringUtils.isNotBlank(parts[1])) { return parts[1]; }
log.warn("Malformed preBindInfo, expected botId:uid: {}", preBindInfo); Defensive patterns
Strategy: type-guard
Validate before calling
boolean validPreBind = preBindInfo != null && preBindInfo.matches("[^:]+:[^:]+"); Type guard
static boolean hasUid(String preBindInfo) {
if (preBindInfo == null) return false;
String[] p = preBindInfo.split(":", 2);
return p.length == 2 && !p[1].isBlank();
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: Pre-bind entries written by an older version with a different format; cache corruption or manual cache edits; expired/partially flushed cache entries.
Understand the failure class
Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12).
Data as JSON: /api/errors/38ccde07f6c420a9.
Report an issue: GitHub.
Appendix: source
Thrown at console/backend/hub/src/main/java/com/iflytek/astron/console/hub/service/wechat/impl/WechatThirdpartyServiceImpl.java:269
}
/**
* Get user ID from pre-binding information
*/
private String getUidFromPreBindInfo(String appid, Integer botId) {
String preBindKey = PRE_BIND_KEY + appid;
RBucket<String> bucket = redissonClient.getBucket(preBindKey);
if (bucket.isExists()) {
String preBindInfo = bucket.get();
try {
// Parse botId:uid format
String[] parts = preBindInfo.split(":");
if (parts.length >= 2) {
return parts[1];
}
} catch (Exception e) {
log.warn("Failed to parse user ID from pre-binding information: appid={}, preBindInfo={}", appid, preBindInfo, e);
}
}
log.warn("Pre-binding user ID not found: appid={}, botId={}", appid, botId);
return null;
}
/**
* Clean up pre-binding cache
*/
private void cleanupPreBindCache(String appid, Integer botId) {
// Clean up pre-binding status
String preBindKey = PRE_BIND_KEY + appid;
redissonClient.getBucket(preBindKey).delete();
// Clean up pre-authorization code
String preAuthCodeKey = PRE_AUTH_CODE_KEY + botId;
redissonClient.getBucket(preAuthCodeKey).delete();View on GitHub (pinned to 5e758547a8)