Tencent/APIJSON · error · UnsupportedOperationException
请求, 不合法!非开放请求不允许传 @key:value !
Error message
{method} 请求,{rk} 不合法!非开放请求不允许传 @key:value ! What it means
Thrown when a non-open request carries the @key key (per-request table-key / primary-key selector). Like @combine, it is a query-shaping directive reserved for open requests; closed requests fix it in configuration.
Solutions
- Drop @key from the payload
- Have the backend set the intended key in the Request-table config or mark the request open
- If you need per-request key selection, expose it via a dedicated open tag
Example fix
// before
{"User":{"name":"a","@key":"userId"}}
// after
{"User":{"name":"a"}} Defensive patterns
Strategy: validation
Validate before calling
function stripLockedKeys(obj) {
const out = { ...obj };
delete out['@key'];
return out;
} Prevention
- Treat @key as server configuration, not a client parameter
- Do not copy example bodies from docs into non-open endpoints
When it happens
Trigger: A request body containing "@key":"userId" sent to a tag whose Request-table row is not open.
Common situations: Frontend adds @key while trying to switch which column identifies rows (e.g. dedupe by userId instead of id) on a locked endpoint; pasting from APIJSON documentation examples.
Related errors
- 请求, 不合法!非开放请求不允许传 @combine:value !
- 请求, 不合法!非开放请求不允许传远程函数 key():"fun()" !
- 字符串 不合法!预编译模式下…
- 写操作请求必须带条件!!!
- 字符 不合法!预编译模式下 中 function 必须符合小写英文单词的 SQL 函数名格式!且必须是后端允许调用的…
AI-assisted analysis of Tencent/APIJSON@5284052872 (2026-08-14).
Data as JSON: /api/errors/0f10a16dbfff4dac.
Report an issue: GitHub.
Appendix: source
Thrown at APIJSONORM/src/main/java/apijson/orm/AbstractVerifier.java:1126
// 判断不允许传的key<<<<<<<<<<<<<<<<<<<<<<<<<
for (String rk : rkset) {
if (rk == null || KEY_STRING.equals(rk) || KEY_TRIM.equals(rk)) {
// ConcurrentModificationException real.remove(rk);
continue;
}
if (refuseSet.contains(rk)) { // 不允许的字段
throw new IllegalArgumentException(method + "请求," + name
+ " 里面不允许传 " + rk + " 等" + StringUtil.get(refuseSet) + "内的任何字段!");
}
if (KEY_COMBINE.equals(rk)) {
throw new UnsupportedOperationException(method + " 请求," + rk + " 不合法!" +
"非开放请求不允许传 " + KEY_COMBINE + ":value !");
}
if (KEY_KEY.equals(rk)) {
throw new UnsupportedOperationException(method + " 请求," + rk + " 不合法!" +
"非开放请求不允许传 " + KEY_KEY + ":value !");
}
Object rv = real.get(rk);
if (rv != null && stringKeyList != null && stringKeyList.contains(rk)) {
rv = toJSONString(rv);
}
if (rv != null && trimKeyList != null && trimKeyList.contains(rk)) {
rv = StringUtil.trim(rv);
}
// 不允许传远程函数,只能后端配置
if (rk.endsWith("()") && rv instanceof String) {
throw new UnsupportedOperationException(method + " 请求," + rk + " 不合法!" +
"非开放请求不允许传远程函数 key():\"fun()\" !");
}
// 不在target内的 key:{}View on GitHub (pinned to 5284052872)