{"record":{"id":"42f4d9f15014d346","repo":"laurent22/joplin","slug":"no-note-with-id-id","errorCode":null,"errorMessage":"No note with id ${id}","messagePattern":"No note with id (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/app-mobile/commands/util/goToNote.ts","lineNumber":16,"sourceCode":"import Note from '@joplin/lib/models/Note';\nimport NavService from '@joplin/lib/services/NavService';\nimport { AttachFileAction } from '../../components/screens/Note/commands/attachFile';\n\nexport interface GotoNoteOptions {\n\tattachFileAction?: AttachFileAction | null;\n}\n\nconst goToNote = async (id: string, hash?: string, options: GotoNoteOptions = null) => {\n\toptions = {\n\t\tattachFileAction: null,\n\t\t...options,\n\t};\n\n\tif (!(await Note.load(id))) {\n\t\tthrow new Error(`No note with id ${id}`);\n\t}\n\n\treturn NavService.go('Note', {\n\t\tnoteId: id,\n\t\tnoteHash: hash,\n\t\tnewNoteAttachFileAction: options.attachFileAction,\n\t});\n};\n\nexport default goToNote;\n","sourceCodeStart":1,"sourceCodeEnd":27,"githubUrl":"https://github.com/laurent22/joplin/blob/2654b33620775080d1d59c552259d41e33dad3d2/packages/app-mobile/commands/util/goToNote.ts#L1-L27","documentation":"Thrown by the mobile `goToNote` command when `Note.load(id)` returns a falsy value, meaning no note row exists in the database for the supplied id. It is a precondition guard before navigating to the `Note` route via `NavService.go`. The id is interpolated verbatim so the caller sees exactly what was looked up.","triggerScenarios":"Calling `goToNote(id, hash?, options?)` with an id that is not present in the SQLite notes table (deleted, never existed, belongs to another profile, or sync has not yet created it). `Note.load` returning `null`/`undefined` for a malformed or empty id string.","commonSituations":"Following a note link from a synced resource before the note has synced down; opening a share/intent with a stale note id from an older backup; cross-profile navigation where the id lives in a different profile's database; the id was passed from an unvalidated deep link.","solutions":["Verify the note exists before calling: `const note = await Note.load(id); if (!note) return;`","Ensure the target profile is active if ids come from a different profile context.","If the id originates from a deep link / share intent, validate it is a non-empty string and trigger a sync before navigating.","Wrap the call in try/catch and surface a user-facing 'note not found' message rather than letting the error propagate."],"exampleFix":"// before\ngoToNote(id);\n\n// after\nif (await Note.load(id)) {\n  await goToNote(id);\n} else {\n  logger.warn('Skipping navigation; note does not exist:', id);\n}","handlingStrategy":"validation","validationCode":"import Note from '@joplin/lib/models/Note';\n\nconst noteExists = async (id: string) => !!(await Note.load(id));\n\nif (!(await noteExists(id))) {\n  logger.warn('Refusing to navigate: note does not exist', id);\n  return;\n}\nawait goToNote(id);","typeGuard":"const isNoteId = (id: unknown): id is string =>\n  typeof id === 'string' && id.length > 0;","tryCatchPattern":"try {\n  await goToNote(id);\n} catch (error) {\n  if (/No note with id/.test(error.message)) {\n    logger.warn('Stale note reference:', id);\n    return;\n  }\n  throw error;\n}","preventionTips":["Validate deep-link / share-intent ids against the database before navigating.","Trigger a sync before opening note links that may not yet be downloaded.","Make sure the active profile matches the one that owns the note id."],"tags":["navigation","notes","validation","mobile","precondition"],"backgroundTag":null,"analyzedSha":"2654b33620775080d1d59c552259d41e33dad3d2","analyzedAt":"2026-08-12T14:26:46.263Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}