Problem
When synchronizing attachments to Jira Cloud you may experience an error related to the filename size. The error looks like this:
Error detail:
There was a problem trying to post attachment 2021-06-07 13.38.52 - {filename} for issue 98296 at services.jcloud.IssueService$$anonfun$$nestedInanonfun$applyAttachments$6$1.applyOrElse(IssueService.scala:704) at services.jcloud.IssueService$$anonfun$$nestedInanonfun$applyAttachments$6$1.applyOrElse(IssueService.scala:702) at scala.concurrent.Future.$anonfun$recoverWith$1(Future.scala:417) at scala.concurrent.impl.Promise.$anonfun$transformWith$1(Promise.scala:41) at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:64) at akka.dispatch.BatchingExecutor$AbstractBatch.processBatch(BatchingExecutor.scala:56) at akka.dispatch.BatchingExecutor$BlockableBatch.$anonfun$run$1(BatchingExecutor.scala:93) at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23) at scala.concurrent.BlockContext$.withBlockContext(BlockContext.scala:85) at akka.dispatch.BatchingExecutor$BlockableBatch.run(BatchingExecutor.scala:93) at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:48) at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(ForkJoinExecutorConfigurator.scala:48) at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290) at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020) at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656) at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594) at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183) Caused by: services.jcloud.exception.AttachmentJiraCloudException: Could not post attachment with name `{filename}` for issue with id `98,296`: Got error while saving attachment: Got exception while saving attachment in attachment store. Exception: com.atlassian.jira.issue.attachment.store.media.MediaApiStreamAttachmentStore$FailureMediaApiResponseException: [AttachmentUploadFailure] Could not upload attachment Failure: Failure{cause=org.apache.http.client.ClientProtocolException, reason=TRANSPORT_ERROR, retryAfter=null, message='null', httpStatusCode=null} caused by: [AttachmentUploadFailure] Could not upload attachment Failure: Failure{cause=org.apache.http.client.ClientProtocolException, reason=TRANSPORT_ERROR, retryAfter=null, message='null', httpStatusCode=null} at services.node.JCloudTrackerExceptionCategoryService.generateCouldNotPostAttachmentJiraCloudTrackerException(JCloudTrackerExceptionCategoryService.scala:517) at services.jcloud.transport.JCloudClient.$anonfun$postAttachment$6(JCloudClient.scala:1130) at services.jcloud.transport.JCloudRestErrorHandlingService$$anonfun$recoverFromRestExceptionToJiraCloudTrackerExceptionOrBugException$1.applyOrElse(JCloudRestErrorHandlingService.scala:178) at services.jcloud.transport.JCloudRestErrorHandlingService$$anonfun$recoverFromRestExceptionToJiraCloudTrackerExceptionOrBugException$1.applyOrElse(JCloudRestErrorHandlingService.scala:171) ... 15 more Caused by: com.exalate.domain.exception.issuetracker.TrackerRestException: Got error while saving attachment: Got exception while saving attachment in attachment store. Exception: com.atlassian.jira.issue.attachment.store.media.MediaApiStreamAttachmentStore$FailureMediaApiResponseException: [AttachmentUploadFailure] Could not upload attachment Failure: Failure{cause=org.apache.http.client.ClientProtocolException, reason=TRANSPORT_ERROR, retryAfter=null, message='null', httpStatusCode=null} caused by: [AttachmentUploadFailure] Could not upload attachment Failure: Failure{cause=org.apache.http.client.ClientProtocolException, reason=TRANSPORT_ERROR, retryAfter=null, message='null', httpStatusCode=null} at services.jcloud.transport.JCloudRestErrorHandlingService$.handleTrackerHigherFourZeroZeroRestResponse(JCloudRestErrorHandlingService.scala:94) at services.jcloud.transport.JCloudRestErrorHandlingService$.handleTrackerFourZeroZeroAndHigherRestResponse(JCloudRestErrorHandlingService.scala:83) at services.jcloud.transport.JCloudRestErrorHandlingService$.filterTrackerRestErrorResponse(JCloudRestErrorHandlingService.scala:72) at services.jcloud.transport.JCloudClient.$anonfun$postAttachment$3(JCloudClient.scala:1123) at scala.concurrent.Future.$anonfun$flatMap$1(Future.scala:307) ... 14 more
Cause
The issue occurs due to a filename size that is bigger than the maximum allowed by Jira Cloud REST API.
Solution
You need to fit a filename size of up to 151 characters.