Unable to change avatar in Jira
Platform Notice: Data Center - This article applies to Atlassian products on the Data Center platform.
Note that this knowledge base article was created for the Data Center version of the product. Data Center knowledge base articles for non-Data Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
Unable to upload custom avatars
Environment
9.12.12
Diagnosis
- When attempting to upload an image for a user avatar from Profile page, clicking on confirm results in the error message: "Error occurred while creating avatar, please contact your Jira administrators".
- Following Error can be seen in the
atlassian-jira.log
:
url: /j9170/rest/api/latest/user/avatar; user: admin ERROR admin 843x197x1 ol4mxd 0:0:0:0:0:0:0:1 /rest/api/latest/user/avatar [c.a.jira.avatar.AvatarPickerHelperImpl] Unable to create avatar.
java.nio.file.FileAlreadyExistsException: /Users/test/jira-home/atlassian-jira-software-9.17.0/data/avatars
url: /j9170/rest/api/latest/user/avatar; user: admin ERROR admin 843x197x1 ol4mxd 0:0:0:0:0:0:0:1 /rest/api/latest/user/avatar [c.a.j.rest.exception.ExceptionInterceptor] Returning internal server error in response
java.lang.reflect.InvocationTargetException
Caused by: com.atlassian.jira.rest.v2.issue.RESTException(Internal Server Error)
at com.atlassian.jira.rest.v2.issue.AvatarResourceHelper.throwWebException(AvatarResourceHelper.java:445)
- Further, upon checking the "avatars" directory in <Jira_Home>/data, we see a symbolic link to it.
Cause
Jira requires the avatars directory to be a physical directory instead of a symbolic link. When Jira attempts to upload an avatar, it tries to create a new directory at the specified location. This results in a FileAlreadyExistsException because the symbolic link already exists.
Solution
- Stop Jira.
- Backup the /avatars directory located in Jira home.
- Remove the symbolic link.
- Start Jira.