Overview
When marking one or multiple emails at once as Spam, you might receive the following error:
JSON API Error: Could not load /api/0/spam/
Information
Root Cause
The reason for this error is because you are trying to mark as Spam a case that is not in the database anymore.
This can happen when the ElasticSearch Index of FogBugz is out-of-sync with the FogBugz database's content. Because of this FogBugz is showing cases in search results that have been already removed from the database.
For example, the case was marked as Spam previously and has been removed by the "Delete Spam after" setting of the Mailbox.
Solution
Follow the instructions described for Cases Missing in Search Results on FogBugz.