theonedev/onedev · error · ExplicitException

Criteria '${operator}' is not supported here

Error message

Criteria '${operator}' is not supported here

What it means

When parsing a pack query, operator criteria (e.g. 'published by me') are only allowed when the parser was built with current-user criteria enabled (withCurrentUserCriteria). If such an operator appears where it is not permitted, PackQuery throws ExplicitException("Criteria '<operator>' is not supported here").

Source

Thrown at server-core/src/main/java/io/onedev/server/search/entity/pack/PackQuery.java:104

			PackQueryParser parser = new PackQueryParser(tokens);
			parser.removeErrorListeners();
			parser.setErrorHandler(new BailErrorStrategy());
			QueryContext queryContext = parser.query();
			CriteriaContext criteriaContext = queryContext.criteria();
			Criteria<Pack> packCriteria;
			if (criteriaContext != null) {
				packCriteria = new PackQueryBaseVisitor<Criteria<Pack>>() {

					@Override
					public Criteria<Pack> visitFuzzyCriteria(FuzzyCriteriaContext ctx) {
						return new FuzzyCriteria(getValue(ctx.getText()));
					}
					
					public Criteria<Pack> visitOperatorCriteria(PackQueryParser.OperatorCriteriaContext ctx) {
						switch (ctx.operator.getType()) {
							case PublishedByMe:
								if (!withCurrentUserCriteria)
									throw new ExplicitException("Criteria '" + ctx.operator.getText() + "' is not supported here");
								return new PublishedByMeCriteria();
							default:
								throw new ExplicitException("Unexpected operator: " + ctx.operator.getText());
						}
					}

					@Override
					public Criteria<Pack> visitOperatorValueCriteria(PackQueryParser.OperatorValueCriteriaContext ctx) {
						var criterias = new ArrayList<Criteria<Pack>>();
						for (var quoted: ctx.criteriaValue.Quoted()) {
							String value = getValue(quoted.getText());
							if (ctx.PublishedByUser() != null)
								criterias.add(new PublishedByUserCriteria(getUser(value)));
							else if (ctx.PublishedByBuild() != null)
								criterias.add(new PublishedViaBuildCriteria(project, value));
							else if (ctx.PublishedByProject() != null)
								criterias.add(new PublishedViaProjectCriteria(value));
							else

View on GitHub (pinned to d44925c47c)

Solutions

  1. Remove the 'published by me' criterion from this query context or use 'published by <user>' instead
  2. Parse the query via the API/entry point that enables current-user criteria if that is intended
  3. Catch ExplicitException and show a user-facing message about the unsupported criterion

Example fix

// before
"published by me" // in a context without current-user criteria
// after
"published by john.doe"
Defensive patterns

Strategy: validation

Validate before calling

if (/published\s+by\s+me/i.test(queryString) && !currentUserCriteriaAllowed) throw new ExplicitException("'published by me' not allowed in this context");

Type guard

null

Try / catch

try { PackQuery.parse(...); } catch (ExplicitException e) { showError("Criterion not supported here: use 'published by <user>'"); }

Prevention

When it happens

Trigger: Parsing a pack query containing 'published by me' (or another operator criterion) in a context where PackQuery was constructed without the current-user criteria flag, e.g. certain parse variants or embedding sites that disallow self-referencing criteria.

Common situations: Using 'published by me' in a project-scoped or system-generated query context that disallows it; copying a query string from the UI into an API call that parses with different options.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06). Data as JSON: /api/errors/0a220dea90774d8b. Report an issue: GitHub.