payloadcms/payload · error · Error

Collection config not found for: ${importCollection}

Error message

Collection config not found for: ${importCollection}

What it means

The createCollectionImport task looks up importCollection in req.payload.config.collections. If no collection with that slug is registered it throws a plain Error. The imports collection must exist in the running Payload config for the task to resolve its upload config.

Source

Thrown at packages/plugin-import-export/src/import/getCreateImportCollectionTask.ts:55

      } = input

      // Fetch the import document to get all necessary data
      const importDoc = await req.payload.findByID({
        id: importId,
        collection: importCollection,
      })

      if (!importDoc) {
        throw new Error(`Import document not found: ${importId}`)
      }

      // Get the collection config for the imports collection
      const collectionConfig = req.payload.config.collections.find(
        (c) => c.slug === importCollection,
      )

      if (!collectionConfig) {
        throw new Error(`Collection config not found for: ${importCollection}`)
      }

      // Retrieve the file using getFileFromDoc (handles both local and cloud storage)
      const file = await getFileFromDoc({
        collectionConfig,
        doc: {
          filename: importDoc.filename as string,
          mimeType: importDoc.mimeType as string | undefined,
          url: importDoc.url as string | undefined,
        },
        req,
      })

      const fileMimetype = file.mimetype || (importDoc.mimeType as string)

      if (!fileMimetype) {
        throw new FileRetrievalError(
          req.t,

View on GitHub (pinned to 00c58b35c0)

Solutions

  1. Ensure importCollection matches a slug present in payload.config.collections.
  2. Check the plugin-import-export config for the imports collection slug and align task input.
  3. If using a custom imports collection, register it in the Payload config.
Defensive patterns

Strategy: validation

Validate before calling

const exists = req.payload.config.collections.some((c) => c.slug === importCollection)
if (!exists) {
  throw new Error(`imports collection not registered: ${importCollection}`)
}

Type guard

const isRegisteredImportsCollection = (slug: string, req: PayloadRequest): boolean =>
  req.payload.config.collections.some((c) => c.slug === slug)

Prevention

When it happens

Trigger: importCollection slug is misspelled or refers to a collection that was removed/renamed; the imports collection is defined by a plugin that isn't installed; config built without the imports collection.

Common situations: Renaming the imports collection without updating the task input; plugin version change that altered the default imports-collection slug; multi-tenant config missing the collection.

Related errors


AI-assisted analysis of payloadcms/payload@00c58b35c0 (2026-08-12). Data as JSON: /api/errors/70edf9a931662e96. Report an issue: GitHub.