Error when opening Notes App page
It's a couple of months that Notes App in browser is showing a generic error saying "Fetching notes has failed. See JavaScript console and server log for details."
In the console I found a bunch of:
NotesService.js:92 TypeError: e is not iterable
at updateNotes (notes.js:130)
at Array.<anonymous> (vuex.esm.js:851)
at u.dispatch (vuex.esm.js:516)
at u.dispatch (vuex.esm.js:406)
at NotesService.js:77
I tried Firefox, Brave, Chrome and Falkon too, with and without adblock addons, no luck.
I have no problem from my android app.
Steps to reproduce
- Open Notes App page
Expected behaviour
List of my notes
Actual behaviour
Blank page with errors
Screenshots

Server
- Notes app version: 4.4.0
- Nextcloud version: 24.0.3
- OS: Linux 5.15.54-1-lts
- Web server: apache 2.4.54
- PHP version: php7 7.4.30
- Database: mariadb 10.8.3
Nextcloud configuration:
Client
- Browser (incl. version): Firefox 102.0.1, Chrome 103.0.5060.53, Falkon 22.04.3
- OS: Arch Linux
Hmm, that's strange. Until now, you're the only person with this problem. You are saying that this error happens since a couple of months. Do you have an idea, what may have changed at that point? Was it a Nextcloud (server or notes app) update? If yes: please restart your apache httpd server, sometimes the server caches some files.
Does the server log contains any errors?
Could you please check the Network-tab of your browser console? There should be a request to .../apps/notes/notes. I'm interested in the response code (is it 200?) and the content (please remove personal data).
I actually have the same issue since (I believe) upgrading to 24.0. Firefox tells me:
TypeError: e is undefined
i notes-main.js:1
updateNotes notes.js:130
h vuex.esm.js:851
dispatch vuex.esm.js:516
dispatch vuex.esm.js:406
g NotesService.js:77
[NotesService.js:92:12](webpack:///src/NotesService.js)
g NotesService.js:92
Chromium:
TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator))
at i (notes-main.js?v=329c6968-0:1:54679)
at u.updateNotes (notes.js:127:30)
at Array.<anonymous> (vuex.esm.js:851:23)
at u.dispatch (vuex.esm.js:516:13)
at u.dispatch (vuex.esm.js:406:21)
at NotesService.js:77:11
(anonymous) @ NotesService.js:92
I also use Arch, but nginx+php-fpm instead of apache, and the whole server has been restarted several times since. The Android application works fine, for what it is worth.
I have no error in my logs, all HTTP responses in the network tab have a 200 status, including the one to apps/notes/notes. The response content is valid JSON, but it's hard to provide anything interesting while keeping the personal information out :-/
Hmmm, interesting. :-/
The response content is valid JSON, but it's hard to provide anything interesting while keeping the personal information out :-/
The response should have this structure:
{
"notesData": [
{ "id":123456, "title":"Note title", "modified":1355853787, "category":"Category1", "favorite":false, "readonly":false, "error":false, "errorType":"", "etag":"ca28268242b6ad1ab9db7eb739792a7c" },
...
],
"noteIds": [ 123456, ... ],
"categories": [ "Category1", ... ],
"settings": { "notesPath": "Notizen", "fileSuffix": ".md", "noteMode": "edit", "customSuffix": ".txt" },
"lastViewedNote": 123456,
"errorMessage": null
}
Could you please check if your response content does look similar? Especially, I would like to know if the notesData and noteIds lists are non-empty arrays (i.e. they have those brackets [ and ] ).
It does look correct:
{"notesData":[{"id":220,"title":"Note1","modified":1649179676,"category":"","favorite":false,"readonly":false,"error":false,"errorType":"","etag":"6feee4c33d5fad6f33d9342768e9b40d"}, [...]],
"noteIds":[43407,45640,12810,45156,44002,39379,25913,26707,50060,31437,50310,3075,37092,12842,2780,31146,36157,44810,36998,31645,33145,41270,50206,43529,35747,220,28110,37160,2998,40446,23899,45961,15748,12859,38316,42682,24421,10472,2635,42716,3204,38322,31015,3063,43147,14149,45250,2755,20065,49102],
"categories":[],
"settings":{"notesPath":"Notes","fileSuffix":".txt","noteMode":"edit","customSuffix":".txt"},
"lastViewedNote":45961,
"errorMessage":null}
I have more entries in notesData, as you can tell by the entries in noteIds, I just redacted most of them.
I have the same error after upgrading from Nextcloud 23.x to 24.0.3 (along with a full system update). Figured I'd remove and reinstall the Notes app from the GUI. It seems to first install 4.0.4, and then tries to update to 4.4.0? This fails with:
App "Notes" cannot be installed because the following dependencies are not fulfilled: PHP with a version lower than 8.0 is required. Server version 22 or lower is required.
Manually extracting the notes.tar.gz file in the webapps/nextcloud/apps directory installs the app again, but the original error is back as well...
What info can I provide to help resolve this issue?
I have a similar setup as @rgacogne (Arch Linux with Nginx)
OK, this is weird. After the steps outlined above, I don't think I did any changes. However, today suddenly the Notes application loads without errors. I did reboot my workstation, could that have resolved it ?!?

Same issue with Notes 4.4.0 on nextcloud 24.0.3 in Firefox and Chromium. The /apps/notes/notes request's response code is 200 and the body appears to be valid JSON (with notesData and noteIds that is filled in). Nextcloud is hosted on arch linux.
I don't find anything suspicious in the response. noteIds is not in the same order as notesData; but that is expected I take it?
Redacted screenshot of the notes response below:

I installed the notes app in dev mode and after applying the following change, my browser doesn't throw the error anymore. Even when I undo the change, the error doesn't return.
diff --git a/src/store/notes.js b/src/store/notes.js
index 2f9d7da2..e9d98d3c 100644
--- a/src/store/notes.js
+++ b/src/store/notes.js
@@ -116,6 +116,9 @@ const mutations = {
const actions = {
updateNotes(context, { noteIds, notes }) {
// add/update new notes
+ if (!notes || !noteIds) {
+ return
+ }
for (const note of notes) {
// TODO check for parallel (local) changes!
context.commit('updateNote', note)
Btw I couldn't get source maps to work in Firefox and chromium, so finding the origin of the error was a PITA. Are source maps working and if not: how would you debug something like this?
Hey @fvdnabee , thanks for your investigations! Together with @bolderbast 's experience, I think there is a caching problem somewhere. However, I have no idea where it is. Nevertheless, I will add another check for undefined. Let's see, if this helps.
Btw I couldn't get source maps to work in Firefox and chromium, so finding the origin of the error was a PITA. Are source maps working and if not: how would you debug something like this?
I'm observing issues with the source maps, too. It looks like the line references in the error console are not correct. After some searching, this could be because we use babel together with webpack. The Notes app is using Nextcloud's webpack config. I think this problem has to be fixed over there. Do you have an idea how to fix it? A PR is always welcome!
I just released Notes v4.5.0. Please check, if the issue still exists.
I upgraded Nextcloud to 24.0.4 and Notes to 4.5.0, rebooted the server for good measure but I still have the issue :-/ Is there anything else I can do to help pinpoint the issue?
For what it is worth, a different user on my instance with no notes also gets the same error.
Since I still have no idea on fixing this, I just released Notes version 4.5.1 which includes some more debug output (based on https://github.com/nextcloud/notes/issues/886#issuecomment-1212847390). Please update to this version and try again. Please have a look at your browser's JavaScript console and search for the string This should not happen, please see issue #886. Please give feedback if it appears and paste the following lines (including the stack trace).
Same error for me, since I upgraded to Nextcloud 24.0.5. (from v23.x), on archlinux. Notes version 4.5.1
But I managed to fix it.
In fact, I had several 'app_paths' in my config, one of them being writable, and the other, not.
The first one, not writable, had still an old version of notes (3.6.1 if I recall correctly), so maybe it created a conflict...
I removed the folder in the first app_path, then I unstalled notes with occ:app remove notes BACLUP YOUR NOTES BEFORE DOING THAT, then reinstalled notes with occ, and now it works beautifully.
My problem might not be related, but I was getting exactly the same error, so some users might have the same 'broken' setup as me.
Before that, I also tried to empty the whole notes folder, but I still had the error.
@cyberic99 What a wonderful trick!! I first tried it with notes app and worked great, then I did the same for news and contacts apps and solved all issues! Thank you :heart:
hey, cool, I m glad I could help !
I can confirm that removing the folder in the first app_path solved the issue for me as well, thanks a lot!
It looks that this issue cannot be fixed within the Notes app and there is a workaround for it. Therefore, I'll close this issue.