Jira server throws attachmentmodule error in the issue view screen

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs 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

When accessing an issue in a Jira application, the Attachment web panel failed to load with the following error appears in the screen:

  • Error rendering 'com.atlassian.jira.jira-view-issue-plugin:attachmentmodule'. Please contact your JIRA application administrators.

Diagnosis

The following exceptions appears in the atlassian-jira.log:

2013-05-22 19:11:20,980 http-bio-8888-exec-2 ERROR tthenhausen 1151x2x2 1dn8de0 37.201.97.7:65439,0:0:0:0:0:0:0:1 /browse/OX-306[jira.web.component.ModuleWebComponentImpl] An exception occured while rendering the web panel: com.atlassian.jira.jira-view-issue-plugin:attachmentmodule (null) java.lang.NullPointerException at com.atlassian.jira.plugin.viewissue.AttachmentBlockContextProvider.shouldExpandAsZip(AttachmentBlockContextProvider.java:195) at com.atlassian.jira.plugin.viewissue.AttachmentBlockContextProvider.convertToSimpleAttachments(AttachmentBlockContextProvider.java:164) at com.atlassian.jira.plugin.viewissue.AttachmentBlockContextProvider.getContextMap(AttachmentBlockContextProvider.java:119) at com.atlassian.jira.plugin.webfragment.CacheableContextProviderDecorator.initContextMap(CacheableContextProviderDecorator.java:70) at com.atlassian.jira.plugin.webfragment.CacheableContextProviderDecorator.getContextMap(CacheableContextProviderDecorator.java:46) at com.atlassian.jira.plugin.webfragment.contextproviders.MultiContextProvider.getContextMap(MultiContextProvider.java:99) at com.atlassian.plugin.web.descriptors.DefaultWebPanelModuleDescriptor$ContextAwareWebPanel.getHtml(DefaultWebPanelModuleDescriptor.java:144) at com.atlassian.jira.web.component.ModuleWebComponentImpl.renderModule(ModuleWebComponentImpl.java:87) at com.atlassian.jira.web.component.ModuleWebComponentImpl.renderModuleAndLetNoThrowablesEscape(ModuleWebComponentImpl.java:70) at com.atlassian.jira.web.component.ModuleWebComponentImpl.renderModule(ModuleWebComponentImpl.java:57) <+3> at java.lang.reflect.Method.invoke(Unknown Source) at com.atlassian.plugin.osgi.hostcomponents.impl.DefaultComponentRegistrar$ContextClassLoaderSettingInvocationHandler.invoke(DefaultComponentRegistrar.java:129) at com.sun.proxy.$Proxy219.renderModule(Unknown Source) <+3> [.....]

Or java.io.IOException: Permission denied

2016-04-27 17:39:45,674 ajp-bio-8009-exec-591 WARN H141051 1059x927882x6 1b73yqg 172.21.8.243 /secure/AjaxIssueAction!default.jspa [jira.issue.attachment.FileSystemAttachmentDirectoryAccessor] Unable to make thumbnail directory /data/JIRA/Home-Main/data/attachments/ACSCLOUD/ACSCLOUD-3868/thumbs 2016-04-27 17:39:45,674 ajp-bio-8009-exec-591 ERROR H141051 1059x927882x6 1b73yqg 172.21.8.243 /secure/AjaxIssueAction!default.jspa [jira.web.component.ModuleWebComponentImpl] An exception occured while rendering the web panel: com.atlassian.jira.jira-view-issue-plugin:attachmentmodule (null) java.lang.IllegalStateException: java.io.IOException: Permission denied at com.atlassian.jira.issue.thumbnail.DefaultThumbnailManager.getTempFile(DefaultThumbnailManager.java:337)

Causes

Solution

Resolution 1

Use this SQL to verify this is the problem you're having:

SELECT * FROM fileattachment WHERE mimetype IS NULL;

If results are returned there are attachments with NULL for their mimetype that can be fixed.

Always back up your data before making any database modifications. If possible, test any alter, insert, update, or delete SQL commands on a staging server first.

First, list all file extensions for attachments with no mime type:

Postgres

SELECT DISTINCT count(*) as occurrences, substring(filename from '\.(?!.*\.).*$') AS extension FROM fileattachment WHERE mimetype IS NULL OR mimetype = '' GROUP BY extension ORDER BY extension;

MySQL

SELECT DISTINCT count(*) as occurrences, substring_index(filename, '.', -1) AS extension FROM fileattachment WHERE mimetype IS NULL OR mimetype = '' GROUP BY extension ORDER BY extension;

Once you choose appropriate MIME types for all the broken attachments you can fix them. Here's an example for GIF images, modify it for each MIME type you determine from the file extensions.

Postgres

UPDATE fileattachment SET mimetype = 'image/gif' WHERE mimetype IS NULL OR mimetype = '' AND substring(filename from '\.(?!.*\.).*$') = 'gif';

MySQL

UPDATE fileattachment SET mimetype = 'image/gif' WHERE mimetype IS NULL OR mimetype = '' AND substring_index(filename, '.', -1) = 'gif';

NOTE: Some attachment file names won't have a "dot three" extension in the name. These must be reviewed one at a time to determine the correct MIME type. Alternatively, you could set mimetype to "text/plain" for these files so they can be downloaded and fixed by consumers.

Postgres

SELECT * FROM fileattachment WHERE mimetype IS NULL OR mimetype = '' AND length(substring(filename from '\.(?!.*\.).*$')) > 4 ORDER BY filename;

MySQL

SELECT * FROM fileattachment WHERE mimetype IS NULL OR mimetype = '' AND length(substring_index(filename, '.', -1)) > 4 ORDER BY filename;

NOTE: The problem may still occur after updating the fileattachment data until you upgrade to JIRA 6.1 or above or the latest version of the JIRA application Python Library.

Resolution 2

ℹ️ Grant all Operating Systems permissions for the user running JIRA to access the JIRA-home and JIRA-install directories and also full access on the attachments directory.

Updated on May 22, 2025

Still need help?

The Atlassian Community is here for you.