Tencent/APIJSON · error · UnsupportedOperationException
@column:value 的 value 中字符串 {expression} 不合法!不允许传超过 100 个字符的函
Error message
@column:value 的 value 中字符串 {expression} 不合法!不允许传超过 100 个字符的函数或表达式!请用 @raw 简化传参! What it means
An UnsupportedOperationException from the GET/GETS branch of gainColumnString: any single ';'-separated expression inside @column:value longer than 100 characters is refused, with the message pointing to @raw as the escape hatch. The limit keeps client-supplied SQL surface small; long expressions must instead be defined server-side and referenced by a short alias.
Source
Thrown at APIJSONORM/src/main/java/apijson/orm/AbstractSQLConfig.java:2472
if (containRaw) { // 由于 HashMap 对 key 做了 hash 处理,所以 get 比 containsValue 更快
if ("".equals(RAW_MAP.get(expression)) || RAW_MAP.containsValue(expression)) { // newSQLConfig<T, M, L> 提前处理好的
continue;
}
// 简单点, 后台配置就带上 AS
int index = expression.lastIndexOf(":");
String alias = expression.substring(index+1);
boolean hasAlias = StringUtil.isName(alias);
String pre = index > 0 && hasAlias ? expression.substring(0, index) : expression;
if (RAW_MAP.containsValue(pre) || "".equals(RAW_MAP.get(pre))) { // newSQLConfig<T, M, L> 提前处理好的
keys[i] = pre + (hasAlias ? gainAs() + q + alias + q : "");
continue;
}
}
if (expression.length() > 100) {
throw new UnsupportedOperationException("@column:value 的 value 中字符串 " + expression + " 不合法!"
+ "不允许传超过 100 个字符的函数或表达式!请用 @raw 简化传参!");
}
keys[i] = parseSQLExpression(KEY_COLUMN, expression, containRaw, true
, "@column:\"column0,column1:alias1;function0(arg0,arg1,...);function1(...):alias2...\"");
}
String c = StringUtil.get(keys);
c = c + (StringUtil.isEmpty(joinColumn, true) ? "" : ", " + joinColumn);//不能在这里改,后续还要用到:
return isMain() && isDistinct() ? PREFIX_DISTINCT + c : c;
default:
throw new UnsupportedOperationException(
"服务器内部错误:getColumnString 不支持 " + RequestMethod.getName(getMethod())
+ " 等 [GET,GETS,HEAD,HEADS,POST] 外的ReuqestMethod!"
);
}
}
/**解析@column 中以“;”分隔的表达式("@column":"expression1;expression2;expression2;....")中的expressionView on GitHub (pinned to 5284052872)
Solutions
- Move the long expression into server-side RAW_MAP (e.g. in AbstractSQLConfig or your subclass) under a short key, then use "@raw":"@column" and put the short key in @column.
- Split the expression at ';' into multiple shorter expressions where semantically valid.
- Shorten by removing spaces and redundant parts.
- If you own the backend, you may raise the limit by patching the length check, but prefer @raw for security.
Example fix
// before
{"User":{"@column":"concat(concat(concat(concat(name,' - '),id),' - '),phone)}}"}
// after — server: RAW_MAP.put("nameLine", "concat(name,' - ',id,' - ',phone)")
{"User":{"@column":"nameLine","@raw":"@column"}} Defensive patterns
Strategy: validation
Validate before calling
const items = (req.User['@column'] || '').split(';');
if (items.some(i => i.length > 100)) throw new Error('expression too long; use @raw'); Type guard
null
Try / catch
catch UnsupportedOperationException; re-issue request with a @raw alias after backend registers the expression
Prevention
- Keep client expressions short
- Centralize long SQL snippets server-side in RAW_MAP
- Watch this limit when upgrading APIJSON versions
When it happens
Trigger: GET request with a long @column expression such as a deeply nested function call, a long CONCAT(...) chain, or a pasted SQL CASE expression exceeding 100 chars in one ';'-item.
Common situations: Frontend assembling formatting expressions dynamically until they grow past the limit; migrating raw SQL views into @column; upgrading APIJSON versions where this hard limit was introduced and previously-working long expressions start failing.
Related errors
- HEAD请求: 字符 {alias} 不合法!预编译模式下 @column:value 中 value里面用 , 分割的
- HEAD请求: 字符{origin} 不合法!预编译模式下 @column:value 中 value里面用 , 分割的
- HEAD请求: 字符 {origin.substring(0, start)} 不合法!预编译模式下 @column:v
- POST 请求必须在Table内设置要保存的 key:value !
- POST请求: 每一个 key:value 中的key都必须是1个单词!
AI-assisted analysis of Tencent/APIJSON@5284052872 (2026-08-14).
Data as JSON: /api/errors/a50c462304290dec.
Report an issue: GitHub.