hcengineering/platform · warning

Linked page not found (outside of this import):

Error message

Linked page not found (outside of this import): 

What it means

During Notion import, preProcessMarkdown rewrites internal links in exported markdown. When a link target's Notion ID is not present in documentMetaMap (the map of pages included in this import), the page was not imported, so the link cannot be rewritten to a Huly page and the warning 'Linked page not found (outside of this import): <href>' is emitted. The link node is left unchanged.

Source

Thrown at packages/importer/src/notion/notion.ts:504

      }
    } else {
      traverseNodeMarks(node, (mark) => {
        if (mark.type === MarkupMarkType.link) {
          const href = mark.attrs?.href ?? ''
          switch (getLinkType(href)) {
            case NOTION_MD_LINK_TYPES.UNKNOWN:
            case NOTION_MD_LINK_TYPES.EXTERNAL_LINK: {
              console.log('skip this type of link: ', href)
              return
            }
            case NOTION_MD_LINK_TYPES.INTERNAL_LINK: {
              const notionId = getFileId('', href)
              const targetMeta = documentMetaMap.get(notionId)
              console.log('Target HULY page ID:', targetMeta?.id)
              if (targetMeta !== undefined) {
                alterInternalLinkNode(node, targetMeta)
              } else {
                console.warn('Linked page not found (outside of this import): ' + href)
              }
              return
            }
            case NOTION_MD_LINK_TYPES.ATTACHMENT: {
              const notionId = getFileId('', href)
              const attachmentMeta = documentMetaMap.get(notionId)
              if (attachmentMeta !== undefined) {
                console.log('Attachment found: ', attachmentMeta)
                alterAttachmentNode(node, attachmentMeta, href)
              } else {
                console.warn('Attachment not found: ', href)
              }
            }
          }
        }
      })
    }
    return true

View on GitHub (pinned to 63e28dc964)

Solutions

  1. Include the linked page in the import selection so targetMeta exists in documentMetaMap.
  2. Accept the broken link and fix it manually in Huly after import.
  3. Pre-process the Notion export to repoint or strip links to pages outside the import.
  4. Verify link classification (internal vs external via isExternalLink/URL.canParse) is not misrouting links.

Example fix

// before
console.warn('Linked page not found (outside of this import): ' + href)
// after
// ensure the target page is part of the import set, or collect for post-import fixup
unresolvedLinks.push(href) // remap in a second pass once all pages are imported
Defensive patterns

Strategy: validation

Validate before calling

// Before import, verify every internal link target is included in the import set
const missing = links.filter(href => !documentMetaMap.has(getFileId('', href)))
if (missing.length > 0) console.warn('Pages outside import:', missing)

Type guard

function hasTargetMeta (href: string, metaMap: Map<string, { id: string }>): boolean {
  return metaMap.has(getFileId('', href))
}

Prevention

When it happens

Trigger: importPageDocument processes a page whose markdown contains an internal Notion link whose getFileId('', href) key is absent from documentMetaMap - i.e. the target page exists in Notion but is outside the selected import set.

Common situations: Selectively importing one page/subtree while it links to pages not included in the import; deleted Notion pages still referenced by links; permission-restricted pages excluded from the export; external links misclassified as internal.

Related errors


AI-assisted analysis of hcengineering/platform@63e28dc964 (2026-08-29). Data as JSON: /api/errors/0a7c47443f10b368. Report an issue: GitHub.