theonedev/onedev · error · NotAcceptableException
Please login to perform this query
Error message
Please login to perform this query
What it means
FieldOperatorCriteria.getValuePredicate() handles the '~is me~' operator on issue choice/user fields by comparing the field value to the current user's name. Because it is user-relative, it throws NotAcceptableException('Please login to perform this query') when User.get() is null at query translation time.
Source
Thrown at server-core/src/main/java/io/onedev/server/search/entity/issue/FieldOperatorCriteria.java:57
public FieldOperatorCriteria(String name, int operator, boolean allowMultiple) {
super(name);
this.operator = operator;
this.allowMultiple = allowMultiple;
}
@Override
protected Predicate getValuePredicate(From<Issue, Issue> issueFrom, From<IssueField, IssueField> fieldFrom, CriteriaBuilder builder) {
Path<?> valueAttribute = fieldFrom.get(IssueField.PROP_VALUE);
Path<?> projectAttribute = issueFrom.get(Issue.PROP_PROJECT);
if (operator == IssueQueryLexer.IsEmpty) {
return null;
} else if (operator == IssueQueryLexer.IsNotEmpty) {
return builder.isNotNull(fieldFrom.get(IssueField.PROP_VALUE));
} else if (operator == IssueQueryLexer.IsMe) {
if (User.get() != null)
return builder.equal(valueAttribute, User.get().getName());
else
throw new NotAcceptableException(_T("Please login to perform this query"));
} else if (operator == IssueQueryLexer.IsNotMe) {
if (User.get() != null) {
return builder.not(builder.equal(valueAttribute, User.get().getName()));
} else {
throw new NotAcceptableException(_T("Please login to perform this query"));
}
} else if (operator == IssueQueryLexer.IsCurrent) {
if (getFieldSpec() instanceof BuildChoiceField) {
Build build = Build.get();
if (build != null) {
return builder.and(
builder.equal(projectAttribute, build.getProject()),
builder.equal(valueAttribute, String.valueOf(build.getNumber())));
} else {
throw new ExplicitException(_T("No current build in query context"));
}
} else if (getFieldSpec() instanceof PullRequestChoiceField) {
PullRequest request = PullRequest.get();View on GitHub (pinned to d44925c47c)
Solutions
- Authenticate the request so User.get() is populated.
- Run the query under a specific user context (impersonation/system user) in jobs.
- Replace 'is me' with '~is "username"~' in queries intended for unauthenticated use.
- Catch NotAcceptableException and return an authentication-required error to the client.
Example fix
// before String query = "~assignees is me~"; // anonymous context -> throws // after String query = User.get() != null ? "~assignees is me~" : "~assignees is \"john\"~";
Defensive patterns
Strategy: validation
Validate before calling
if (User.get() == null) throw new NotAcceptableException("Login required for '~is me~' query"); Type guard
boolean canRun = User.get() != null;
Try / catch
try { issues = queryManager.find(null, query); } catch (NotAcceptableException e) { return Response.status(401).entity(e.getMessage()).build(); } Prevention
- Authenticate API clients before executing user-relative operators
- Store saved queries with explicit usernames for service accounts
- Guard query execution with a User.get() != null check
When it happens
Trigger: Executing an issue query with '~<field> is me~' (e.g. '~assignees is me~', '~fields is me~') via the JPA predicate path while unauthenticated: anonymous REST/GraphQL request, background job, or service call without a user bound.
Common situations: Saved queries containing 'is me' executed by CI scripts without tokens; webhook/email integrations running user-authored queries anonymously; dashboards evaluated outside a session.
Related errors
- Not authenticated
- Invalid access token
- Authentication required
- Invalid access token
- Please login to perform this query
AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06).
Data as JSON: /api/errors/95b083f6fba9921c.
Report an issue: GitHub.