theonedev/onedev · error · ExplicitException
Field not found: ${fieldName}
Error message
Field not found: ${fieldName} What it means
PackQuery.checkField validates that a field name used with an operator in a pack query is one of QUERY_FIELDS, and then that the operator is valid for that field. An unknown field name throws ExplicitException("Field not found: <fieldName>").
Source
Thrown at server-core/src/main/java/io/onedev/server/search/entity/pack/PackQuery.java:233
if (order.direction.getText().equals("desc"))
packSort.setDirection(DESCENDING);
else
packSort.setDirection(ASCENDING);
} else {
packSort.setDirection(sortField.getDefaultDirection());
}
buildSorts.add(packSort);
}
return new PackQuery(packCriteria, buildSorts);
} else {
return new PackQuery();
}
}
public static void checkField(Project project, String fieldName, int operator) {
if (!QUERY_FIELDS.contains(fieldName))
throw new ExplicitException("Field not found: " + fieldName);
switch (operator) {
case IsUntil:
case IsSince:
if (!fieldName.equals(NAME_PUBLISH_DATE))
throw newOperatorException(fieldName, operator);
break;
case Is:
case IsNot:
if (!fieldName.equals(NAME_PROJECT) && !fieldName.equals(NAME_TYPE)
&& !fieldName.equals(NAME_NAME) && !fieldName.equals(NAME_VERSION)
&& !fieldName.equals(NAME_LABEL)) {
throw newOperatorException(fieldName, operator);
}
break;
}
}
private static ExplicitException newOperatorException(String fieldName, int operator) {View on GitHub (pinned to d44925c47c)
Solutions
- Use a field defined in PackQuery.QUERY_FIELDS (e.g. 'publish date')
- Verify exact field spelling against the pack query documentation/UI autocomplete
- Catch ExplicitException and surface valid field names to the caller
Example fix
// before "created is since "2024-01-01"" // 'created' not a pack field // after ""publish date" is since "2024-01-01""
Defensive patterns
Strategy: validation
Validate before calling
function validatePackField(f) { const fields = ['publish date']; /* PackQuery.QUERY_FIELDS */ if (!fields.includes(f)) throw new Error('Field not found: ' + f); } Type guard
null
Try / catch
try { PackQuery.parse(project, q); } catch (ExplicitException e) { if (e.getMessage().startsWith('Field not found')) showError('Unknown pack query field: ' + e.getMessage()); else throw e; } Prevention
- Use only fields in PackQuery.QUERY_FIELDS
- Do not reuse field names from other entity queries
- Pair each field with operators valid for it (e.g. publish date with is since/is until)
- Check field spelling against docs/UI
When it happens
Trigger: Calling PackQuery.parse with a field-operator-value criterion (e.g. '<field> is since <value>') where <field> is not in PackQuery.QUERY_FIELDS — misspellings or fields from other entity types (issue/build query fields) used in pack queries.
Common situations: Reusing issue query field names in pack queries; typos in field names; version changes renaming fields; API clients constructing query strings programmatically with wrong field keys.
Understand the failure class
Background: "Invalid query parameter" / "Failed to parse value of ...": fixing bad query string parameters across APIs — this error's family across 36 libraries.
Related errors
- Criteria '${operator}' is not supported here
- Unexpected operator: ${operator}
- Unexpected criteria: ${operator}
- Cannot order by field: ${fieldName}
- Invalid number: ${value}
AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06).
Data as JSON: /api/errors/bd7212c6e4274402.
Report an issue: GitHub.