Tencent/APIJSON · error · IllegalArgumentException

预编译模式下 @fill:value 中 {item} 不合法! value 里面用 , 分割的每一项必须是 colum

Error message

预编译模式下 @fill:value 中 {item} 不合法! value 里面用 , 分割的每一项必须是 column 且其中 column 必须是 数字或英语字母组合!并且不要有多余的空格!

What it means

Prepared-mode validation of @fill:value: every comma-separated item must be StringUtil.isName or StringUtil.isCombineOfNumOrAlpha (letters and digits only). FILL clause items are inlined, so symbols/spaces are rejected.

Source

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

			return StringUtil.isEmpty(joinFill, true) ? "" : (hasPrefix ? " FILL(" : "") + joinFill + ")";
		}

		for (int i = 0; i < keys.length; i++) {
			String item = keys[i];
			if ("NULL".equals(item) || "LINEAR".equals(item) || "PREV".equals(item) || "PREVIOUS".equals(item)) {
				continue;
			}

			String origin = item;

			if (isPrepared()) { //不能通过 ? 来代替,SELECT 'id','name' 返回的就是 id:"id", name:"name",而不是数据库里的值!
				//这里既不对origin trim,也不对 ASC/DESC ignoreCase,希望前端严格传没有任何空格的字符串过来,减少传输数据量,节约服务器性能
				if (StringUtil.isName(origin)) {}
				else if (StringUtil.isCombineOfNumOrAlpha(origin)) {
					continue;
				}
				else {
					throw new IllegalArgumentException("预编译模式下 @fill:value 中 " + item + " 不合法! value 里面用 , 分割的"
							+ "每一项必须是 column 且其中 column 必须是 数字或英语字母组合!并且不要有多余的空格!");
				}
			}

			keys[i] = gainKey(origin);
		}

		return (hasPrefix ? " FILL(" : "") + StringUtil.concat(StringUtil.get(keys), joinFill, ", ") + ")";
	}

	@Override
	public String getOrder() {
		return order;
	}
	public AbstractSQLConfig<T, M, L> setOrder(String... conditions) {
		return setOrder(StringUtil.get(conditions));
	}
	@Override

View on GitHub (pinned to 5284052872)

Solutions

  1. Join items with ',' and no spaces: "@fill": "id,name"
  2. Keep each item a bare column or alphanumeric token
  3. Move any expression into RAW_MAP + @raw

Example fix

// before
{"@fill": "id, name"}
// after
{"@fill": "id,name"}
Defensive patterns

Strategy: validation

Validate before calling

const ok = s => /^[A-Za-z_][A-Za-z0-9_]*$/.test(s) || /^[A-Za-z0-9]+$/.test(s);
for (const item of String(obj['@fill'] ?? '').split(',')) {
  if (item && !ok(item)) throw new Error(`@fill item '${item}' must be a name or digit/letter combo`);
}

Type guard

const isFillItemValid = s => /^[A-Za-z_][A-Za-z0-9_]*$/.test(s) || /^[A-Za-z0-9]+$/.test(s);

Try / catch

try { await api.get(req); } catch (e) { if (e.message.includes('@fill')) req['@fill'] = req['@fill'].split(',').map(x => x.trim()).join(','); else throw e; }

Prevention

When it happens

Trigger: "@fill": "id, name" (space after comma), "@fill": "prev()" — an item that is neither a name nor a digit/letter combination.

Common situations: Readable lists built with ', ' separators; ClickHouse FILL modifiers expressed as expressions rather than bare tokens.

Related errors


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