I have some batch code that creates ContentNotes in Apex. It was working perfectly well until all of a sudden last night it stopped working without any code changes whatsoever. It is now throwing the dreaded "System.UnexpectedException: Note can't be saved" error.

I stripped it down to the following test case, which fails in the sandbox in which it had been previously working, but passes in another?!?!

ContentNote n = new ContentNote();
n.Title = 'test';
n.Content = Blob.valueOf('test');
insert n;

I will also file a case, but does anything jump out to anyone? Has anyone encountered a sudden appearance of this error before? Thanks!

  • Please add your api versions as well as what instances you checked.
    – Adrian Larson
    Nov 9, 2017 at 20:09
  • API version 41.0 (in both cases). Two sandboxes (cs91 and cs97) from the same prod org. I even deactivated a ContentVersion trigger but that wasn't it. Nov 9, 2017 at 20:24
  • Also just realized that I had maxed out my File/Note allocation for the sandbox, so that might explain it. Checking that theory now... Nov 9, 2017 at 20:25
  • I emptied the recycle bin and the Data Storage page shows 0% usage, but still not working. Nov 9, 2017 at 20:58

1 Answer 1


Well, it looks like the problem was due to running out of storage space in this sandbox. What's strange is that it took an hour or more after deleting Files & Note and emptying the recycle bin for me to be allowed to create ContentNote records again.

In any case, if you get the strange, uncatchable, "UnexpectedException" in the future, make sure you check the storage space in your org.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .