Create issue object returns null without any erros

Hi Atlassians,
I have a customer with Jira version 8.7.1 who can’t create issues using my plugin, and the reason doesn’t seem clear.
I tried to debug it locally on my environment and everything seems to be fine.
We create issues by the following snipper

 IssueService.CreateValidationResult result = issueService.validateCreate(user, issueInputParameters);
            if (!result.getErrorCollection().hasAnyErrors()) {
                IssueService.IssueResult issueResult = issueService.create(user, result);
                if (issueResult.getIssue() == null || !issueResult.isValid()) {
                    logger.error( "Could not create issue in project {} errors:  {} "),
                            targetProject, String.join(COMMA_SPACE, result.getErrorCollection().getErrorMessages()));
                }

Only for this customer I see the following log for every issue we try to create
Could not create an issue in project Development Project errors:
So the issueResult.getIssue() do return null without any error in the errors collections.
Do you have any observation of what can be the issue?

There’s some problems with your snippet. This process is two step, but you only check for errors once. We need to check both results. Furthermore, the ErrorCollection has both Errors and ErrorMessages. You should print both.

  1. #validateCreate returns a CreateValidationResult
  2. Check the CreateValidationResult for validity, if invalid print all errors
  3. #create returns a IssueResult
  4. Check the IssueResult for validity, if invalid print all errors
IssueService.CreateValidationResult validationResult = issueService.validateCreate(user, issueInputParameters);
if (!validationResult.isValid()) {
    logger.error( "Could not validate creation of new issue in project {} errors: {} ", 
        targetProject, validationResult.getErrorCollection().toString());
    return;
}

IssueService.IssueResult actualIssueResult = issueService.create(user, validationResult);
if (!actualIssueResult.isValid()) {
    logger.error( "Could not create new issue in project {} errors: {} ", 
        targetProject, actualIssueResult.getErrorCollection().toString());
    return;
} 

logger.info("Created new issue {}" actualIssueResult.getIssue().getKey());

Hi @StevenBehnke ,
I did what you suggested, and still, the the error collection returns empty so in my code I write to the logs as you suggested

    logger.error( "Could not create new issue in project {} errors: {} ", 
        targetProject, actualIssueResult.getErrorCollection().toString());

And in the logs I see:
Could not create issue in project Securty Project errors: Errors: {} Error Messages: []
How can I debug it in such a case?

Hi @OfirNir ,
You can try
actualIssueResult.getErrorCollection().getErrors().values()

But a more reliable way is to configure your Jira instance as a remote debug target, connect your IDE, set breakpoint and explore structure of actualIssueResult object.