hcengineering/platform · warning
Attachment not found:
Error message
Attachment not found:
What it means
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.
Source
Thrown at packages/importer/src/notion/notion.ts:515
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
})
}
function getLinkType (href: string): NOTION_MD_LINK_TYPES {
console.log('original link href: ' + href)
if (isExternalLink(href)) return NOTION_MD_LINK_TYPES.EXTERNAL_LINK
const notionId = extractNotionId(href)
if (notionId !== null && notionId !== undefined && notionId !== '') {
return NOTION_MD_LINK_TYPES.INTERNAL_LINK
}View on GitHub (pinned to 63e28dc964)
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.
Example fix
// before
console.warn('Attachment not found: ', href)
// after
console.warn('Attachment not found: ', href)
missingAttachments.push(href) // surface a report so users can re-upload or re-export Defensive patterns
Strategy: validation
Validate before calling
// Pre-flight: ensure all attachments referenced in markdown exist in the import metadata
const missing = attachmentHrefs.filter(href => !documentMetaMap.has(getFileId('', href)))
if (missing.length > 0) {
console.warn('Missing attachments, re-export needed:', missing)
return
}
Type guard
function attachmentExists (href: string, metaMap: Map<string, { id: string }>): boolean {
return metaMap.has(getFileId('', href))
}
Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Linked page not found (outside of this import):
- Unsupported entry type, skipping:
- Teamspace not found for document: ${docMeta.name}
- Importing folder entry is not supported: ${fileMeta.fileName
- DB file not found: ${docMeta.name}
AI-assisted analysis of hcengineering/platform@63e28dc964 (2026-08-29).
Data as JSON: /api/errors/dce5724d9bde1e69.
Report an issue: GitHub.