1

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 '17 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. – ArtieBrosius Nov 9 '17 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... – ArtieBrosius Nov 9 '17 at 20:25
  • I emptied the recycle bin and the Data Storage page shows 0% usage, but still not working. – ArtieBrosius Nov 9 '17 at 20:58
0

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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.