theonedev/onedev · error · NotAcceptableException

Error validating param auto merge commit message:

Error message

Error validating param auto merge commit message: 

What it means

OneDev throws this NotAcceptableException when the supplied autoMergeCommitMessage fails request.checkMergeCommitMessage(user, message). The validation returns an error string (e.g. missing required trailer, invalid format, exceeds limits) and it is wrapped with this 'Error validating param auto merge commit message:' prefix.

Source

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

                pullRequestReviewService.createOrUpdate(user, review);
        }

        var autoMergeEnabled = (Boolean) data.remove("autoMerge");
        if (autoMergeEnabled != null) {
            if (!SecurityUtils.canWriteCode(request.getProject()))
                throw new UnauthorizedException("Code write permission is required to edit auto merge");
            if (!request.isOpen())
                throw new NotAcceptableException("Pull request is closed");

            if (autoMergeEnabled && request.checkMergeCondition() == null) 
                throw new NotAcceptableException("This pull request is not eligible for auto-merge, as it can be merged directly now");

            var autoMerge = new AutoMerge();
            autoMerge.setEnabled(autoMergeEnabled);
            autoMerge.setCommitMessage(trimToNull((String) data.remove("autoMergeCommitMessage")));
            var errorMessage = request.checkMergeCommitMessage(user, autoMerge.getCommitMessage());
            if (errorMessage != null) 
                throw new NotAcceptableException("Error validating param auto merge commit message: " + errorMessage);

            pullRequestChangeService.changeAutoMerge(user, request, autoMerge);
        }
                    
        return PullRequestHelper.getDetail(currentProject, request);        
    }    

    @Path("/approve-pull-request")
    @Consumes(MediaType.TEXT_PLAIN)
    @POST
    public Map<String, Object> approvePullRequest(
                @QueryParam("currentProject") @NotNull String currentProjectPath,
                @QueryParam("reference") @NotNull String pullRequestReference,
                String comment) {
        var user = SecurityUtils.getUser();
        if (user == null)
            throw new UnauthenticatedException();

View on GitHub (pinned to d44925c47c)

Solutions

  1. Inspect the returned errorMessage suffix to see exactly which rule failed and fix the message accordingly.
  2. Fetch the project's commit message settings/validators and compose a conforming message.
  3. Send autoMerge without autoMergeCommitMessage to use the default message instead of a custom one.

Example fix

// before
updatePullRequest(ref, { autoMerge: true, autoMergeCommitMessage: 'merge it' })
// after
updatePullRequest(ref, { autoMerge: true, autoMergeCommitMessage: 'Fix bug #123' }) // includes required issue ref
Defensive patterns

Strategy: validation

Validate before calling

const msg = buildAutoMergeCommitMessage(pr)
if (!msg || !requiredTrailerPresent(msg)) throw new Error('autoMergeCommitMessage fails project commit message rules')
await updatePullRequest(ref, { autoMerge: true, autoMergeCommitMessage: msg })

Type guard

function isValidCommitMessage(msg) { return typeof msg === 'string' && msg.trim().length > 0 && /#\d+/.test(msg) }

Try / catch

try { await updatePullRequest(ref, { autoMerge: true, autoMergeCommitMessage: msg }) }
catch (e) { if (String(e.message).startsWith('Error validating param auto merge commit message:')) { console.error(e.message.split(': ').pop()); /* fix message and retry */ } else throw e }

Prevention

When it happens

Trigger: Calling the update-pull-request endpoint with autoMerge=true/false plus an autoMergeCommitMessage that fails pull request commit-message validation rules configured on the project (required patterns, forbidden content, length).

Common situations: Project has a commit message checker requiring e.g. a issue reference that the provided message lacks; the message is empty after trim while one is required; the message contains characters the checker rejects.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


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