Tencent/APIJSON · error · IllegalArgumentException
{}:{ @combine:'{}' } 中字符 '{}' 不合法!逻辑连接符 & 右边缺少一个空格 !逻辑连接符 &
Error message
{}:{ @combine:'{}' } 中字符 '{}' 不合法!逻辑连接符 & 右边缺少一个空格 !逻辑连接符 & | 左右必须各一个相邻空格!空格不能多也不能少!不允许首尾有空格,也不允许连续空格!左括号 ( 的右边 和 右括号 ) 的左边 都不允许有相邻空格! What it means
In @combine parsing, '&' is only treated as a logic operator when the previous char was a space (last == ' '); the operator form additionally requires the next char to be a space. If '&' follows its leading space but is not followed by exactly one space (end of string or non-space next), this error is thrown — the '&' operator must have one adjacent space on BOTH sides.
Source
Thrown at APIJSONORM/src/main/java/apijson/orm/AbstractSQLConfig.java:3549
result += "( " + gainCondition(isNot, wi) + " )";
isNot = false;
first = false;
}
key = "";
lastLogic = 0;
if (isOver) {
break;
}
}
if (c == ' ') {
}
else if (c == '&') {
if (last == ' ') {
if (i >= n - 1 || s.charAt(i + 1) != ' ') {
throw new IllegalArgumentException(errPrefix + " 中字符 '" + (i >= n - 1 ? s : s.substring(0, i + 1))
+ "' 不合法!逻辑连接符 & 右边缺少一个空格 !逻辑连接符 & | 左右必须各一个相邻空格!空格不能多也不能少!"
+ "不允许首尾有空格,也不允许连续空格!左括号 ( 的右边 和 右括号 ) 的左边 都不允许有相邻空格!");
}
result += SQL.AND;
lastLogic = c;
i ++;
}
else {
key += c;
}
}
else if (c == '|') {
if (last == ' ') {
if (i >= n - 1 || s.charAt(i + 1) != ' ') {
throw new IllegalArgumentException(table + ":{ @combine: '" + combine
+ "' } 中字符 '" + (i >= n - 1 ? s : s.substring(0, i + 1))
+ "' 不合法!逻辑连接符 | 右边缺少一个空格 !逻辑连接符 & | 左右必须各一个相邻空格!空格不能多也不能少!"View on GitHub (pinned to 5284052872)
Solutions
- Format every operator as ' & ' — exactly one space before and after: "id & name".
- Build expressions with a helper that always joins with ' & ' / ' | ' (see validation code).
- Run a grammar pre-check before sending (see validation code).
Example fix
// before
{"@combine":"id &name"}
// after
{"@combine":"id & name"} Defensive patterns
Strategy: validation
Validate before calling
if (!combine.matches("(\\S+|\\([^()]*\\))(\\s[&|]\\s(\\S+|\\([^()]*\\)))*"))
throw new IllegalArgumentException("@combine must use exactly one space around each & and |"); Type guard
const WELL_SPACED = /^(?:\S+|\([^()]*\))(?:\s[&|]\s(?:\S+|\([^()]*\)))*$/;
function isWellSpaced(combine: string): boolean { return WELL_SPACED.test(combine); } Prevention
- Always type operators as ' & ' with a space on both sides.
- Never minify whitespace inside the @combine string value.
- Generate expressions with join(' & ') helpers.
When it happens
Trigger: @combine:"id &name", "id &", or "id & name" variants where after '&' comes end-of-string or a non-space char. (The double-space case is separately caught as an empty-key error.) Trigger point: line 3549, when s.charAt(i+1) != ' ' or i >= n-1.
Common situations: Hand-typing expressions with one space around the operator; concatenating "a " + "& " + "b" incorrectly (yielding "a & b" vs "a &b"); minifying JSON and stripping spaces inside the @combine string value by accident.
Related errors
- {}:{ @combine: '{}' } 中字符 '{}' 不合法!逻辑连接符 | 右边缺少一个空格 !逻辑连接符 &
- {}:{ @combine:'{}' } 中字符 '{}' 不合法!非逻辑符 '!' 右边多了一个空格 ' ' !非逻辑
- {errPrefix} 中字符 '{s}' 不合法!不允许首尾有空格,也不允许连续空格!空格不能多也不能少!逻辑连接符
- {errPrefix} 中字符 '{s}' 不合法!空格 ' ' 左边缺少条件 key !逻辑连接符 & | 左右必须各
- {errPrefix} 中字符 '{key}' 不合法!左边缺少 & | 其中一个逻辑连接符!
AI-assisted analysis of Tencent/APIJSON@5284052872 (2026-08-14).
Data as JSON: /api/errors/b90d3bd71666e686.
Report an issue: GitHub.