hcengineering/platform · error · Error
Importing folder entry is not supported: ${fileMeta.fileName
Error message
Importing folder entry is not supported: ${fileMeta.fileName} What it means
importFile handles importing a single Notion page/file export; folder entries are handled elsewhere (importFiles filters them). A folder reaching importFile means the caller passed a directory-style entry into the page-import path, which cannot read it as a file, so it throws before starting the import promise.
Source
Thrown at packages/importer/src/notion/notion.ts:248
if (spaceId === undefined || spaceId === false) {
throw new Error('Teamspace not found for document: ' + docMeta.name)
}
await importFile(client, fileUploader, fileMeta, docMeta, spaceId, documentMetaMap)
}
}
}
async function importFile (
client: TxOperations,
fileUploader: FileUploader,
fileMeta: FileMetadata,
docMeta: DocumentMetadata,
spaceId: Ref<Teamspace>,
documentMetaMap: Map<string, DocumentMetadata>
): Promise<void> {
await new Promise<void>((resolve, reject) => {
if (fileMeta.isFolder) throw new Error('Importing folder entry is not supported: ' + fileMeta.fileName)
console.log('IMPORT STARTED:', fileMeta.fileName)
readFile(fileMeta.fileName)
.then((data) => {
const { notionParentId } = docMeta
const parentMeta =
notionParentId !== undefined && notionParentId !== '' ? documentMetaMap.get(notionParentId) : undefined
const processFileData = getDataProcessor(fileMeta, docMeta)
processFileData(client, fileUploader, data, docMeta, spaceId, parentMeta, documentMetaMap)
.then(() => {
console.log('IMPORT SUCCEED:', docMeta.name)
console.log('------------------------------------------------------------------')
resolve()
})
.catch((error) => {
handleImportFailure(docMeta.name, error, reject)View on GitHub (pinned to 63e28dc964)
Solutions
- Filter out entries with isFolder === true before calling importFile or importFilesToSpace
- Route folder entries through importFiles, which already skips them
- Fix the code that builds FileMetadata so directories are not marked as importable file entries
Example fix
// before
for (const entry of entries) {
await importFile(client, fileUploader, entry, docMeta, spaceId, documentMetaMap)
}
// after
for (const entry of entries) {
if (entry.isFolder) continue
await importFile(client, fileUploader, entry, docMeta, spaceId, documentMetaMap)
} Defensive patterns
Strategy: validation
Validate before calling
if (fileMeta.isFolder) {
throw new Error('Refusing to import folder entry: ' + fileMeta.fileName)
}
await importFile(client, fileUploader, fileMeta, docMeta, spaceId, documentMetaMap) Type guard
function isFileEntry(meta) {
return meta.isFolder !== true
} Try / catch
try {
await importFile(client, fileUploader, fileMeta, docMeta, spaceId, documentMetaMap)
} catch (err) {
if (err.message.startsWith('Importing folder entry is not supported: ')) {
console.warn('Skipping folder entry:', fileMeta.fileName)
return
}
throw err
} Prevention
- Filter isFolder entries before invoking importFile or importFilesToSpace
- Use importFiles as the entry point — it already skips folders
- Sanity-check FileMetadata construction so directories are flagged correctly
- Validate entry lists (files only) before starting imports
When it happens
Trigger: Calling importFile (or importFilesToSpace) directly with a FileMetadata whose isFolder is true, e.g. when manually walking a Notion export and not filtering folders, or when an upstream isFolder flag is wrong.
Common situations: Custom scripts iterating the exported zip and passing every entry (including directories) to importFile; exporters that mark folders inconsistently; calling importFilesToSpace with a mixed list of files and folders.
Related errors
- Teamspace not found for document: ${docMeta.name}
- DB file not found: ${docMeta.name}
- DB page metadata not found: ${docMeta.name}
- Cannot import attachment without parent doc: ${docMeta.id}
- Linked page not found (outside of this import):
AI-assisted analysis of hcengineering/platform@63e28dc964 (2026-08-29).
Data as JSON: /api/errors/e438dadd373a4d8d.
Report an issue: GitHub.