{"record":{"id":"6ad4d0c5d86d9e69","repo":"laurent22/joplin","slug":"no-folder-with-id-id","errorCode":null,"errorMessage":"No folder with id ${id}","messagePattern":"No folder with id (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/app-mobile/commands/util/goToFolder.ts","lineNumber":6,"sourceCode":"import Folder from '@joplin/lib/models/Folder';\nimport NavService from '@joplin/lib/services/NavService';\n\nconst goToFolder = async (id: string) => {\n\tif (!(await Folder.load(id))) {\n\t\tthrow new Error(`No folder with id ${id}`);\n\t}\n\treturn NavService.go('Notes', { folderId: id });\n};\n\nexport default goToFolder;\n","sourceCodeStart":1,"sourceCodeEnd":12,"githubUrl":"https://github.com/laurent22/joplin/blob/2654b33620775080d1d59c552259d41e33dad3d2/packages/app-mobile/commands/util/goToFolder.ts#L1-L12","documentation":"Thrown by goToFolder when Folder.load(id) returns null — no folder with the given id exists in the database. The helper navigates to the Notes route for a folder; navigation requires the folder to exist.","triggerScenarios":"goToFolder(id) is called (typically from openItemById after resolving a Folder link) and Folder.load(id) yields null. The `if (!(await Folder.load(id)))` guard throws.","commonSituations":"A link targets a notebook that was deleted; the folder has not synced to this device yet; the id is from another profile; a stale/edited link with a wrong id.","solutions":["Sync to pull the latest folder set to this device.","Verify the id exists via Folder.load before navigating.","Remove or fix the stale folder link in its source note.","Catch the error and show a 'notebook not found' message instead of crashing."],"exampleFix":"// before\nif (!(await Folder.load(id))) {\n  throw new Error(`No folder with id ${id}`);\n}\n\n// after — softer message with sync hint\nif (!(await Folder.load(id))) {\n  throw new Error(`No folder with id ${id}. It may have been deleted or not yet synced.`);\n}","handlingStrategy":"validation","validationCode":"const folder = await Folder.load(id);\nif (!folder) {\n  // sync then retry, or inform user the notebook is gone\n  await reg.syncAll();\n  if (!(await Folder.load(id))) return;\n}","typeGuard":"function folderExists(folder: FolderEntity | null): folder is FolderEntity {\n  return folder != null;\n}","tryCatchPattern":"try {\n  await goToFolder(id);\n} catch (e) {\n  if (e.message.startsWith('No folder with id')) {\n    // sync, retry once; else show 'notebook not found'\n  } else throw e;\n}","preventionTips":["Sync before navigating to folder links from other devices.","Validate folder IDs against the DB before navigating.","Remove stale folder links when the target is deleted."],"tags":["mobile","notebook","navigation","validation","sync"],"backgroundTag":null,"analyzedSha":"2654b33620775080d1d59c552259d41e33dad3d2","analyzedAt":"2026-08-12T14:26:46.263Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}