Tencent/APIJSON · error · IllegalArgumentException

{errPrefix} 中字符 '{key}' 对应的条件键值对 {column}:value 不存在!

Error message

{errPrefix} 中字符 '{key}' 对应的条件键值对 {column}:value 不存在!

What it means

Each key in @combine is looked up in the conditionMap (the table's where/having entries). If the map neither contains the column nor maps it to null, the key is treated as a placeholder expression requiring a ':suffix' (e.g. "col:condition" syntax for @null-style placeholders); when that suffix is also empty, the key references a condition that does not exist and the expression cannot be built.

Source

Thrown at APIJSONORM/src/main/java/apijson/orm/AbstractSQLConfig.java:3503

						}

						allCount ++;
						if (allCount > maxCombineCount && maxCombineCount > 0) {
							throw new IllegalArgumentException(errPrefix + " 中字符 '" + s + "' 不合法!"
									+ "其中 key 数量 " + allCount + " 已超过最大值,必须在条件键值对数量 0-" + maxCombineCount + " 内!");
						}

						String column = key;
						int keyIndex = column.indexOf(":");
						column = keyIndex > 0 ? column.substring(0, keyIndex) : column;
						Object value = conditionMap.get(column);
						String wi = "";
						if (value == null && conditionMap.containsKey(column) == false) { // 兼容@null
							isNot = false; // 以占位表达式为准
							size++; // 兼容 key 数量判断
							wi = keyIndex > 0 ? key.substring(keyIndex + 1) : "";
							if (StringUtil.isEmpty(wi)) {
								throw new IllegalArgumentException(errPrefix + " 中字符 '"
										+ key + "' 对应的条件键值对 " + column + ":value 不存在!");
							}
						} else {
							wi = isHaving ? gainHavingItem(quote, table, alias, column, (String) value, containRaw)
									: gainWhereItem(column, value, method, verifyName);
						}

						if (1.0f*allCount/size > maxCombineRatio && maxCombineRatio > 0) {
							throw new IllegalArgumentException(errPrefix + " 中字符 '" + s + "' 不合法!"
									+ "其中 key 数量 " + allCount + " / 条件键值对数量 " + size + " = " + (1.0f*allCount/size)
									+ " 已超过 最大倍数,必须在条件键值对数量 0-" + maxCombineRatio + " 倍内!");
						}

						if (StringUtil.isEmpty(wi, true)) {  // 转成 1=1 ?
							throw new IllegalArgumentException(errPrefix + " 中字符 '" + key
									+ "' 对应的 " + column + ":value 不是有效条件键值对!");
						}

View on GitHub (pinned to 5284052872)

Solutions

  1. Make every key in @combine exactly match a key present in the same table object (or @having object).
  2. Generate @combine from the actual condition key set, not a hardcoded list (see validation code).
  3. Fix typos/case — matching is exact string equality on the column name before any ':'.

Example fix

// before
{"User":{"id":1,"@combine":"id & name"}}
// after
{"User":{"id":1,"name":"a","@combine":"id & name"}}
Defensive patterns

Strategy: validation

Validate before calling

Set<String> condKeys = tableObj.keySet().stream().filter(k -> !k.startsWith("@")).collect(Collectors.toSet());
for (String k : combine.replaceAll("[()!]", " ").split("\\s*[&|]\\s*")) {
    String col = k.split(":")[0];
    if (!condKeys.contains(col)) throw new IllegalStateException("@combine key not in conditions: " + col);
}

Type guard

function combineKeysExist(combine: string, condKeys: Set<string>): boolean {
  return combine.replace(/[()!]/g, ' ').split(/\s*[&|]\s*/).every(t => condKeys.has(t.split(':')[0]));
}

Prevention

When it happens

Trigger: @combine:"name & status" where the request object contains {"id":1} only — 'name' and 'status' have no key:value pairs. Or a typo: @combine:"usrId" while the condition key is "userId". For @having, the key must exist in the @having object.

Common situations: Renaming request keys but not the @combine string; building @combine from a different field list than the conditions; copy-pasting combine examples from docs without matching keys; deleting a filter field but leaving it in @combine.

Related errors


AI-assisted analysis of Tencent/APIJSON@5284052872 (2026-08-14). Data as JSON: /api/errors/46f61a5622c383f4. Report an issue: GitHub.