{"record":{"id":"47ad1bc24f0e6084","repo":"laurent22/joplin","slug":"unsupported-item-type-for-links-item-type","errorCode":null,"errorMessage":"Unsupported item type for links: ${item.type_}","messagePattern":"Unsupported item type for links: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/app-mobile/commands/openItem.ts","lineNumber":35,"sourceCode":"\tname: 'openItem',\n};\n\nconst openItemById = async (itemId: string, hash?: string) => {\n\tlogger.info(`Navigating to item ${itemId}`);\n\tconst item: BaseItemEntity = await BaseItem.loadItemById(itemId);\n\n\tif (!item) {\n\t\tthrow new Error(`Item not found: ${itemId}`);\n\t}\n\n\tif (item.type_ === ModelType.Note) {\n\t\tawait goToNote(itemId, hash);\n\t} else if (item.type_ === ModelType.Resource) {\n\t\tawait showResource(item);\n\t} else if (item.type_ === ModelType.Folder) {\n\t\tawait goToFolder(item.id);\n\t} else {\n\t\tthrow new Error(`Unsupported item type for links: ${item.type_}`);\n\t}\n};\n\nexport const runtime = (): CommandRuntime => {\n\treturn {\n\t\texecute: async (_context: CommandContext, link: string) => {\n\t\t\tif (!link) throw new Error('Link cannot be empty');\n\n\t\t\ttry {\n\t\t\t\tif (link.startsWith('joplin://') || link.startsWith(':/')) {\n\t\t\t\t\tconst parsedResourceUrl = parseResourceUrl(link);\n\t\t\t\t\tconst parsedCallbackUrl = isCallbackUrl(link) ? parseCallbackUrl(link) : null;\n\n\t\t\t\t\tif (parsedResourceUrl) {\n\t\t\t\t\t\tconst { itemId, hash } = parsedResourceUrl;\n\t\t\t\t\t\tawait openItemById(itemId, hash);\n\t\t\t\t\t} else if (parsedCallbackUrl) {\n\t\t\t\t\t\tconst id = parsedCallbackUrl.params.id;","sourceCodeStart":17,"sourceCodeEnd":53,"githubUrl":"https://github.com/laurent22/joplin/blob/2654b33620775080d1d59c552259d41e33dad3d2/packages/app-mobile/commands/openItem.ts#L17-L53","documentation":"Thrown by openItemById when the loaded item's type_ is not Note, Resource, or Folder. The mobile link handler only knows how to navigate to those three types; anything else (tag, master_key, smart_filter, etc.) is not openable as a link target.","triggerScenarios":"A joplin:///:/ link resolves to an item whose type_ is e.g. ModelType.Tag or ModelType.MasterKey. The if/else chain in openItemById exhausts the three supported branches and falls into the else.","commonSituations":"A link was hand-crafted or generated by a plugin pointing at a non-openable entity; a future/unknown item type returned by a newer sync; a corrupted type_ field; linking to an alarm or filter item.","solutions":["Validate item.type_ against the supported set (Note/Resource/Folder) before navigation.","Regenerate the link so it targets a Note, Resource, or Folder.","Catch and show which type was unsupported for easier diagnosis.","Extend openItemById if a new type genuinely needs link support."],"exampleFix":"// before\n} else {\n  throw new Error(`Unsupported item type for links: ${item.type_}`);\n}\n\n// after — name the type via ModelType for clarity\n} else {\n  throw new Error(`Unsupported item type for links: ${ModelType[item.type_] ?? item.type_}`);\n}","handlingStrategy":"type-guard","validationCode":"const OPENABLE = new Set([ModelType.Note, ModelType.Resource, ModelType.Folder]);\nif (!OPENABLE.has(item.type_)) {\n  // inform user this item type is not link-openable\n  return;\n}","typeGuard":"function isOpenableType(type: ModelType): boolean {\n  return type === ModelType.Note || type === ModelType.Resource || type === ModelType.Folder;\n}","tryCatchPattern":"try {\n  await openItemById(itemId);\n} catch (e) {\n  if (e.message.startsWith('Unsupported item type')) {\n    // show 'this kind of item cannot be opened'\n  } else throw e;\n}","preventionTips":["Validate item.type_ against the supported set before navigation.","Generate links only to Note/Resource/Folder targets.","Extend openItemById deliberately when adding support for a new type."],"tags":["mobile","links","type-dispatch","validation"],"backgroundTag":null,"analyzedSha":"2654b33620775080d1d59c552259d41e33dad3d2","analyzedAt":"2026-08-12T14:26:46.263Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}