Could not save attachment data from stream error when adding attachments to issue in Jira server

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform Notice: Server and Data Center Only - This article only applies to Atlassian products on the server and data center platforms.


Problem 1

When attempting to attach files to an issue, the following error message is thrown

An error occurred while attaching name.ext: Could not save attachment data from stream

Nothing is thrown in the logs when this is happening

Problem 2

When attempting to attach files to an issue, the file may seem to successfully attach but cannot be opened, or it won't successfully attach at all.

The following is thrown in theatlassian-jira.log

2015-07-13 17:13:09,853 http-bio-6471-exec-5 WARN spiderman xxx xxx /secure/AttachFile.jspa [jira.issue.managers.DefaultAttachmentManager] Got exception while saving attachment in attachment store. Exception: Unable to create target file <JIRA Home>/data/attachments/TEST/TEST-4/10200


Caused by: /var/atlassian/application-data/jira/data/attachments/ABC/ABC-123/10000 (No such file or directory)

Problem 3

When uploading attachments the UI displays the error "An internal error has occurred. Please contact your administrator."

The browser console (inside its developer tools panel) might show an error similar to this:

batch.js?agile_global_admin_condition=true&baseurl-check-resources=true&csp_IsNotDevModeCondition=true&csp_IsSysAdminCondition=true&healthcheck-resources=true&jag=true&jaguser=true&jira.create.linked.issue=true&locale=en-US&richediton=true&user-logged-in=true:10172 POST https://<JIRA_BASE_URL>/rest/internal/2/AttachTemporaryFile?filename=data-1615234721693.csv&size=25453881&atl_token=BEWN-74VL-4IH7-TGIK_467e29e204835444e2020d6dd1d4d8a6a4721d89_lin&formToken=&issueId=483082 net::ERR_CONNECTION_RESET


Problem 1

Attachments are disabled upon JIRA start up and the following stack trace is thrown during JIRA start up

2015-05-13 23:05:44,404 localhost-startStop-1 ERROR      [atlassian.jira.upgrade.ConsistencyCheckImpl] Attachments are turned on, Errors: {}
Error Messages: [attachment path [<JIRA Home>/caches/tmp_attachments] invalid] - disabling attachments

Problem 2

Attaching files to specific issue tickets fail, but other tickets are successful.

Problem 3

HTTP dump logs (enabled in the page Cog Icon > Logging and profiling) will show the request data having zero bytes in size: o772x68058x3 HECTMP1 [02/Aug/2021:12:52:31 -0400] "POST https://<JIRA_BASE_URL>/rest/internal/2/AttachTemporaryFile HTTP/1.1" 500 119 18.9060 "https://<JIRA_BASE_URL>/browse/PROJECT-6" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36" "1homd4c"
        ___ Request _____________________________________________________
        Request URL Parameters : 
        Request Data (0 bytes).
        ___ Response ____________________________________________________
        Response HTTP Headers : 
            Cache-Control=no-cache, no-store, no-transform
            Access-Control-Expose-Headers=Origin, Authorization, Content-Type
        Response Data (total 119 bytes) : 
    {"errorMessage":"An error occured while attaching web.xml: Could not save attachment data from stream."}


Problem 1: The user starting JIRA does not have appropriate permissions to the <JIRA Home>/caches/tmp_attachments directory OR there are some misconfiguration in the server.xml (in this case use the default configuration back)


Problem 2: Every issue will have their own directory for attachments (<JIRA Home>/data/attachments/TEST/TEST-4). These directories are not owned by the user currently used to start JIRA. It is possibly owned by root. This can happen if at one point, your JIRA instance was started by user root. When a new directory is created in this session, it will be owned by root. If JIRA is started by the correct user (eg. jira) the next time, this user won't have permission to access the directory created by root hence causing problems attaching files for this particular issue

Another possibility for Problem 2 would be antivirus software preventing the files to be written.

Problem 3: Something in between the browser and Jira is tampering with the contents of the POST request used to upload the attachment. Some examples include:

  • Security software, such as antivirus.
  • Firewalls and WAFs (web application firewalls).
  • VPNs.
  • Browser extensions.


Fix the permissions for the affected directory

  • In Linux, you can fix the permission for the entire JIRA Home directory by running the following command in the terminal

    sudo chown -R jira:jira /var/atlassian/application-data/jira
    chmod -R 755 /var/atlassian/application-data/jira

    (info) The command above assumes the user starting JIRA is jira and that you used the installer, hence the default JIRA Home path. If your user has a different name, use it instead of jira and if you used a custom path, fix the permissions for your custom JIRA Home directory.

If there's antivirus software present, try disabling it to check if the issue goes away. If it does, configure it in a way to allow the attachments to be saved.

If the /data/attachments/ directory is located on a mounted storage location, please also check the mounting options to ensure that it is optimized.


When attempting to attach files to an issue, the following error message is thrown, "An error occurred while attaching name.ext: Could not save attachment data from stream." Alternatively,
when attempting to attach files to an issue, the file may seem to successfully attach but cannot be opened, or it won't successfully attach at all.

Last modified on Aug 11, 2021

Was this helpful?

Provide feedback about this article
Powered by Confluence and Scroll Viewport.