{"record":{"id":"e438dadd373a4d8d","repo":"hcengineering/platform","slug":"importing-folder-entry-is-not-supported-filemet","errorCode":null,"errorMessage":"Importing folder entry is not supported: ${fileMeta.fileName}","messagePattern":"Importing folder entry is not supported: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/importer/src/notion/notion.ts","lineNumber":248,"sourceCode":"      if (spaceId === undefined || spaceId === false) {\n        throw new Error('Teamspace not found for document: ' + docMeta.name)\n      }\n\n      await importFile(client, fileUploader, fileMeta, docMeta, spaceId, documentMetaMap)\n    }\n  }\n}\n\nasync function importFile (\n  client: TxOperations,\n  fileUploader: FileUploader,\n  fileMeta: FileMetadata,\n  docMeta: DocumentMetadata,\n  spaceId: Ref<Teamspace>,\n  documentMetaMap: Map<string, DocumentMetadata>\n): Promise<void> {\n  await new Promise<void>((resolve, reject) => {\n    if (fileMeta.isFolder) throw new Error('Importing folder entry is not supported: ' + fileMeta.fileName)\n\n    console.log('IMPORT STARTED:', fileMeta.fileName)\n    readFile(fileMeta.fileName)\n      .then((data) => {\n        const { notionParentId } = docMeta\n\n        const parentMeta =\n          notionParentId !== undefined && notionParentId !== '' ? documentMetaMap.get(notionParentId) : undefined\n\n        const processFileData = getDataProcessor(fileMeta, docMeta)\n        processFileData(client, fileUploader, data, docMeta, spaceId, parentMeta, documentMetaMap)\n          .then(() => {\n            console.log('IMPORT SUCCEED:', docMeta.name)\n            console.log('------------------------------------------------------------------')\n            resolve()\n          })\n          .catch((error) => {\n            handleImportFailure(docMeta.name, error, reject)","sourceCodeStart":230,"sourceCodeEnd":266,"githubUrl":"https://github.com/hcengineering/platform/blob/63e28dc96483967b2fc21c881b3f1023c1de7718/packages/importer/src/notion/notion.ts#L230-L266","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nfor (const entry of entries) {\n  await importFile(client, fileUploader, entry, docMeta, spaceId, documentMetaMap)\n}\n// after\nfor (const entry of entries) {\n  if (entry.isFolder) continue\n  await importFile(client, fileUploader, entry, docMeta, spaceId, documentMetaMap)\n}","handlingStrategy":"validation","validationCode":"if (fileMeta.isFolder) {\n  throw new Error('Refusing to import folder entry: ' + fileMeta.fileName)\n}\nawait importFile(client, fileUploader, fileMeta, docMeta, spaceId, documentMetaMap)","typeGuard":"function isFileEntry(meta) {\n  return meta.isFolder !== true\n}","tryCatchPattern":"try {\n  await importFile(client, fileUploader, fileMeta, docMeta, spaceId, documentMetaMap)\n} catch (err) {\n  if (err.message.startsWith('Importing folder entry is not supported: ')) {\n    console.warn('Skipping folder entry:', fileMeta.fileName)\n    return\n  }\n  throw err\n}","preventionTips":["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"],"tags":["notion","import","unsupported-input"],"backgroundTag":"unsupported-entry-type","analyzedSha":"63e28dc96483967b2fc21c881b3f1023c1de7718","analyzedAt":"2026-08-29T15:21:27.377Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}