theonedev/onedev · error · NotAcceptableException
Please login to perform this query
Error message
Please login to perform this query
What it means
SubmittedByMeCriteria.getPredicate builds a predicate matching issues submitted by the current user (User.get()). Without an authenticated user it throws NotAcceptableException 'Please login to perform this query', as 'me' is unresolved.
Source
Thrown at server-core/src/main/java/io/onedev/server/search/entity/issue/SubmittedByMeCriteria.java:29
import org.jspecify.annotations.Nullable;
import io.onedev.server.exception.NotAcceptableException;
import io.onedev.server.model.Issue;
import io.onedev.server.model.User;
import io.onedev.server.security.SecurityUtils;
import io.onedev.server.util.ProjectScope;
public class SubmittedByMeCriteria extends SubmittedByCriteria {
private static final long serialVersionUID = 1L;
@Override
public Predicate getPredicate(@Nullable ProjectScope projectScope, CriteriaQuery<?> query, From<Issue, Issue> from, CriteriaBuilder builder) {
if (User.get() != null) {
Path<User> attribute = from.get(Issue.PROP_SUBMITTER);
return builder.equal(attribute, User.get());
} else {
throw new NotAcceptableException(_T("Please login to perform this query"));
}
}
@Override
public User getUser() {
return SecurityUtils.getUser();
}
@Override
public boolean matches(Issue issue) {
if (User.get() != null)
return User.get().equals(issue.getSubmitter());
else
throw new NotAcceptableException(_T("Please login to perform this query"));
}
@Override
public String toStringWithoutParens() {View on GitHub (pinned to d44925c47c)
Solutions
- Authenticate the request (session login or API token in Authorization header).
- Replace 'submitted by me' with an explicit submitter criterion for anonymous/automation use.
- Check user context before running me-based queries and redirect to login.
- Catch NotAcceptableException and return HTTP 406 prompting authentication.
Example fix
// before curl "http://server/api/issues?query=submitted by me" // after curl -H "Authorization: Bearer <token>" "http://server/api/issues?query=submitted by me"
Defensive patterns
Strategy: validation
Validate before calling
if (SecurityUtils.getUser() == null)
throw new NotAcceptableException("Please login to perform this query"); Type guard
User current = User.get(); boolean canRunMeQuery = current != null;
Try / catch
try {
List<Issue> issues = query.find();
} catch (NotAcceptableException e) {
redirectToLogin();
} Prevention
- Use service-account tokens for automated queries containing 'submitted by me'.
- Detect expired sessions and re-authenticate before retrying queries.
- Prefer explicit submitter criteria in anonymous-facing contexts.
When it happens
Trigger: Running an issue query with the 'submitted by me' criterion while anonymous — unauthenticated REST issue queries or sessions without a login.
Common situations: Anonymous dashboards or API integrations lacking credentials executing saved queries containing 'submitted by me'; expired sessions falling back to anonymous.
Related errors
- Please login to perform this query
- No project in query context
- No branch in query context
- Authentication required
- Unauthenticated
AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06).
Data as JSON: /api/errors/6a8192b2aba7f4ec.
Report an issue: GitHub.