Tencent/APIJSON · error · IllegalArgumentException
后端 Request 表中 ALLOW_PARTIAL_UPDATE_FAIL:value 中 {key} 不合法![]
Error message
后端 Request 表中 ALLOW_PARTIAL_UPDATE_FAIL:value 中 {key} 不合法![] 前必须有名字! What it means
After stripping the trailing '[]' from an ALLOW_PARTIAL_UPDATE_FAIL token, the remaining name must be non-empty ('String k = key.substring(0, key.length()-2); if (k.isEmpty()) throw'). A token that is exactly '[]' (no table name before the brackets) is meaningless and rejected. This guards against malformed values like a stray '[]' entry produced by string-splitting or bad config edits.
Source
Thrown at APIJSONORM/src/main/java/apijson/orm/AbstractVerifier.java:1243
// 校验并配置允许批量增删改部分失败<<<<<<<<<<<<<<<<<<<
String allowPartialUpdateFail = StringUtil.get(getString(target, ALLOW_PARTIAL_UPDATE_FAIL.name()));
String[] partialFails = StringUtil.split(allowPartialUpdateFail);
if (partialFails != null && partialFails.length > 0) {
for (String key : partialFails) {
if (isArrayKey(key) == false) {
throw new IllegalArgumentException("后端 Request 表中 " + ALLOW_PARTIAL_UPDATE_FAIL.name()
+ ":value 中 " + key + " 不合法!必须以 [] 结尾!");
}
if (target.get(key) instanceof Collection == false) {
throw new IllegalArgumentException("后端 Request 表中 " + ALLOW_PARTIAL_UPDATE_FAIL.name()
+ ":value 中 " + key + " 对应的 " + key + ":[] 不存在!");
}
// 可能 Table[] 和 Table:alias[] 冲突 int index = key.indexOf(":");
// String k = index < 0 ? key.substring(0, key.length() - 2) : key.substring(0, index);
String k = key.substring(0, key.length() - 2);
if (k.isEmpty()) {
throw new IllegalArgumentException("后端 Request 表中 " + ALLOW_PARTIAL_UPDATE_FAIL.name()
+ ":value 中 " + key + " 不合法![] 前必须有名字!");
}
AbstractSQLConfig.ALLOW_PARTIAL_UPDATE_FAIL_TABLE_MAP.putIfAbsent(k, "");
}
}
// 校验并配置允许部分批量增删改失败>>>>>>>>>>>>>>>>>>>
String[] nks = ifObj == null ? null : StringUtil.split(getString(real, KEY_NULL));
Collection<?> nkl = nks == null || nks.length <= 0 ? new HashSet<>() : Arrays.asList(nks);
Set<Map.Entry<String, Object>> ifSet = ifObj == null ? null : ifObj.entrySet();
if (ifIsStr || (ifSet != null && ifSet.isEmpty() == false)) {
// 没必要限制,都是后端配置的,安全可控,而且可能确实有特殊需求,需要 id, @column 等
// List<String> condKeys = new ArrayList<>(Arrays.asList(apijson.JSONMap.KEY_ID, apijson.JSONMap.KEY_ID_IN
// , apijson.JSONMap.KEY_USER_ID, apijson.JSONMap.KEY_USER_ID_IN));
// condKeys.addAll(apijson.JSONMap.TABLE_KEY_LIST);View on GitHub (pinned to 5284052872)
Solutions
- Remove the bare '[]' token so every entry has a table name, e.g. "User[]".
- If generating ALLOW_PARTIAL_UPDATE_FAIL in code, skip empty table names before joining tokens: tokens.stream().filter(t -> !t.isEmpty()).map(t -> t + "[]")...
- Validate the config once after editing: every token must match ^[A-Za-z0-9_]+\[\]$.
Example fix
// before
{"ALLOW_PARTIAL_UPDATE_FAIL":"[]"}
// after
{"ALLOW_PARTIAL_UPDATE_FAIL":"User[]","User[]":[]} Defensive patterns
Strategy: validation
Validate before calling
String buildPartialFail(List<String> tables) {
List<String> t = tables == null ? List.of() : tables.stream()
.filter(x -> x != null && !x.isEmpty().trim()).map(x -> x + "[]").collect(Collectors.toList());
return t.isEmpty() ? null : String.join(",", t);
} Prevention
- Never build ALLOW_PARTIAL_UPDATE_FAIL by naive concatenation of a possibly-empty variable with "[]".
- Add unit test asserting no generated token equals "[]".
When it happens
Trigger: ALLOW_PARTIAL_UPDATE_FAIL is set to "[]" or contains '[]' among its space/comma-separated tokens (e.g. "User[],[]"). The check runs before the token is put into AbstractSQLConfig.ALLOW_PARTIAL_UPDATE_FAIL_TABLE_MAP, so the request fails during verification.
Common situations: Config generated programmatically where the table-name variable was empty/null and concatenated as ""+"[]"; manual JSON editing that leaves an empty key; copy-paste of a placeholder from docs without replacing <Table>[].
Related errors
- 后端 Request 表中 ALLOW_PARTIAL_UPDATE_FAIL:value 中 {key} 不合法!必须
- 后端 Request 表中 ALLOW_PARTIAL_UPDATE_FAIL:value 中 {key} 对应的 {k
- Request 表 structure 配置的 IF:{ {k}:value } 中 value 不合法,必须是 JSO
- 找不到 version: ${version}, method: ${method.name()}, tag: ${ta
- HEAD请求: 字符 {alias} 不合法!预编译模式下 @column:value 中 value里面用 , 分割的
AI-assisted analysis of Tencent/APIJSON@5284052872 (2026-08-14).
Data as JSON: /api/errors/0cdfedbf9046466d.
Report an issue: GitHub.