OK, I’ve tracked this down. I added a function to ‘org-agenda-finalize-hook’ which makes modifications to the agenda buffer (viz. removing the 'mouse-highlight text properties). At line 3441 of org-agenda.el, in the ‘org-agenda-finalize’ function, this hook is run outside of any (let ((inhibit-read-only t)) ...). This gives the error.
Only some types of agenda buffers are set to be read-only – e.g. ‘org-todo-list’ sets read-only at l. 4418 of org-agenda.el. I think ‘org-agenda-finalize-hook’ should be run with inhibit-read-only bound to t, to let the hook modify the agenda buffer in any case. But otherwise, it should be added to the hook’s documentation that any changes to the agenda buffer could be turned into an error by a read-only setting. -- Aaron Ecay