theonedev/onedev · error · UnauthenticatedException

Authentication required

Error message

Authentication required

What it means

Authentication guard on the REST endpoint /get-commit-message-requirement in TodResource: the caller has no authenticated session (SecurityUtils.getUser() is null), so the request cannot be attributed to a user and UnauthenticatedException is thrown before the project is accessed. Fix: authenticate (log in / supply valid credentials) before calling.

Source

Thrown at server-core/src/main/java/io/onedev/server/ai/TodResource.java:247

        return projectContext;
    }

    private Map<String, Object> getFieldProperties(FieldSpec field) {
        var fieldProperties = new HashMap<>(IssueHelper.getFieldProperties(field));
        fieldProperties.put("description", escapeHtml5((String) fieldProperties.get("description")));
        return fieldProperties;
    }

    @Api(description = "Get commit message requirement")
    @Path("/get-commit-message-requirement")
    @GET
    @Nullable
    public String getCommitMessageRequirement(
                @QueryParam("project") @NotNull String projectPath, 
                @QueryParam("branch") @NotNull String branch) {
        var user = SecurityUtils.getUser();
        if (user == null)
            throw new UnauthenticatedException();

        var project = getProject(projectPath);
        if (!SecurityUtils.canWriteCode(project))
            throw new UnauthorizedException();
            
        return getCommitMessageRequirement(user, project, branch);
    }

    @Nullable
    private String getCommitMessageRequirement(User user, Project project, String branch) {            
        var requirementBuilder = new StringBuilder();
        var branchProtection = project.getBranchProtection(branch, user);
        if (branchProtection.getCommitMessageChecker() instanceof ConventionalCommitChecker checker) {
            requirementBuilder.append("Commit messages should use Conventional Commits format: ")
                    .append("<type>[optional (scope)][!]: <description>. Git revert messages are also allowed.");
            if (!checker.getCommitTypes().isEmpty()) {
                requirementBuilder.append("\nAllowed commit types: ")
                        .append(String.join(", ", checker.getCommitTypes()));

View on GitHub (pinned to d44925c47c)

Solutions

  1. Authenticate the request (login session or API access token) and retry.
  2. Configure the tod client with valid credentials.
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at server-core/src/main/java/io/onedev/server/ai/TodResource.java:247 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class


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