{"record":{"id":"dce5724d9bde1e69","repo":"hcengineering/platform","slug":"attachment-not-found","errorCode":null,"errorMessage":"Attachment not found: ","messagePattern":"Attachment not found: ","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/importer/src/notion/notion.ts","lineNumber":515,"sourceCode":"            case NOTION_MD_LINK_TYPES.INTERNAL_LINK: {\n              const notionId = getFileId('', href)\n              const targetMeta = documentMetaMap.get(notionId)\n              console.log('Target HULY page ID:', targetMeta?.id)\n              if (targetMeta !== undefined) {\n                alterInternalLinkNode(node, targetMeta)\n              } else {\n                console.warn('Linked page not found (outside of this import): ' + href)\n              }\n              return\n            }\n            case NOTION_MD_LINK_TYPES.ATTACHMENT: {\n              const notionId = getFileId('', href)\n              const attachmentMeta = documentMetaMap.get(notionId)\n              if (attachmentMeta !== undefined) {\n                console.log('Attachment found: ', attachmentMeta)\n                alterAttachmentNode(node, attachmentMeta, href)\n              } else {\n                console.warn('Attachment not found: ', href)\n              }\n            }\n          }\n        }\n      })\n    }\n    return true\n  })\n}\n\nfunction getLinkType (href: string): NOTION_MD_LINK_TYPES {\n  console.log('original link href: ' + href)\n  if (isExternalLink(href)) return NOTION_MD_LINK_TYPES.EXTERNAL_LINK\n\n  const notionId = extractNotionId(href)\n  if (notionId !== null && notionId !== undefined && notionId !== '') {\n    return NOTION_MD_LINK_TYPES.INTERNAL_LINK\n  }","sourceCodeStart":497,"sourceCodeEnd":533,"githubUrl":"https://github.com/hcengineering/platform/blob/63e28dc96483967b2fc21c881b3f1023c1de7718/packages/importer/src/notion/notion.ts#L497-L533","documentation":"preProcessMarkdown rewrites attachment nodes in Notion markdown by looking up the attachment's Notion file ID in documentMetaMap. When attachmentMeta is undefined the attachment was not part of the import metadata, so the node cannot be converted to a Huly attachment and 'Attachment not found: <href>' is warned. The attachment node is left as-is, typically producing a broken file reference after import.","triggerScenarios":"An attachment link in the imported page maps (getFileId('', href)) to an ID missing from documentMetaMap - the file/attachment was not included in the import payload or its metadata was not registered.","commonSituations":"Files excluded from the Notion export (large files, unsupported types); attachments living on pages outside the import set; Notion export missing file blocks due to API errors or permission limits; interrupted export downloads.","solutions":["Re-run the Notion export ensuring all file/attachment blocks are included and downloaded.","Import the page owning the attachment so its metadata lands in documentMetaMap.","Manually re-upload missing attachments in Huly after import.","Add retry/validation when building documentMetaMap to catch files that failed to download."],"exampleFix":"// before\nconsole.warn('Attachment not found: ', href)\n// after\nconsole.warn('Attachment not found: ', href)\nmissingAttachments.push(href) // surface a report so users can re-upload or re-export","handlingStrategy":"validation","validationCode":"// Pre-flight: ensure all attachments referenced in markdown exist in the import metadata\nconst missing = attachmentHrefs.filter(href => !documentMetaMap.has(getFileId('', href)))\nif (missing.length > 0) {\n  console.warn('Missing attachments, re-export needed:', missing)\n  return\n}\n","typeGuard":"function attachmentExists (href: string, metaMap: Map<string, { id: string }>): boolean {\n  return metaMap.has(getFileId('', href))\n}\n","tryCatchPattern":null,"preventionTips":["Ensure the Notion export includes all files before importing.","Report missing attachments to the user instead of silently dropping.","Re-upload missing attachments in Huly after import."],"tags":["import","notion","attachments","migration"],"backgroundTag":"imported-attachment-missing","analyzedSha":"63e28dc96483967b2fc21c881b3f1023c1de7718","analyzedAt":"2026-08-29T15:21:27.377Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}