filamentphp/filament · error · InvalidArgumentException

Import column of class [$importColumnClass] must have a uniq

Error message

Import column of class [$importColumnClass] must have a unique name, passed to the [make()] method.

What it means

Every Filament import column needs a unique name that maps it to a CSV header and to the importer property it fills. `ImportColumn::make()` falls back to `getDefaultName()`, which returns `null` on the base class, so a blank or missing name fails fast with an InvalidArgumentException before any configuration runs. The check uses `blank()`, so `null`, `''`, and whitespace-only strings all trigger it.

Source

Thrown at packages/actions/src/Imports/ImportColumn.php:101

    protected string $evaluationIdentifier = 'column';

    protected string | Htmlable | Closure | null $helperText = null;

    protected bool | Closure $isSensitive = false;

    final public function __construct(string $name)
    {
        $this->name($name);
    }

    public static function make(?string $name = null): static
    {
        $importColumnClass = static::class;

        $name ??= static::getDefaultName();

        if (blank($name)) {
            throw new InvalidArgumentException("Import column of class [$importColumnClass] must have a unique name, passed to the [make()] method.");
        }

        $static = app($importColumnClass, ['name' => $name]);
        $static->configure();

        return $static;
    }

    public static function getDefaultName(): ?string
    {
        return null;
    }

    public function getSelect(): Select
    {
        return Select::make($this->getName())
            ->label($this->getLabel())
            ->placeholder(__('filament-actions::import.modal.form.columns.placeholder'))

View on GitHub (pinned to 53483fa934)

Solutions

  1. Pass an explicit, unique name: `ImportColumn::make('email')`.
  2. When generating columns from dynamic data, default the value: `ImportColumn::make($header ?? 'column_' . $index)`.
  3. In reusable custom column classes, override `getDefaultName()` to return a non-blank default.

Example fix

// before
ImportColumn::make()
    ->numeric(),

// after
ImportColumn::make('email')
    ->required(),
Defensive patterns

Strategy: type-guard

Validate before calling

foreach ($headers as $index => $header) {
    if (blank($header)) {
        continue; // or throw with $index context
    }

    $columns[] = ImportColumn::make($header);
}

Type guard

function assertImportColumnName(?string $name): string
{
    if (blank($name)) {
        throw new InvalidArgumentException('Import column name required, got: ' . var_export($name, true));
    }

    return $name;
}

// ImportColumn::make(assertImportColumnName($header))

Prevention

When it happens

Trigger: `ImportColumn::make()` with no argument in a class that does not override `getDefaultName()`, or `ImportColumn::make($header)` where `$header` is null or an empty/whitespace string when the schema is built.

Common situations: Generating importer schemas dynamically from uploaded CSV headers, looping over a config array where a key is missing, or copy-pasting a column definition and deleting the name.

Related errors


AI-assisted analysis of filamentphp/filament@53483fa934 (2026-08-17). Data as JSON: /api/errors/51f5ebe4cb7d1da2. Report an issue: GitHub.