filamentphp/filament · error · LogicException

Record arrays must have a unique [key] entry for identificat

Error message

Record arrays must have a unique [key] entry for identification.

What it means

Error "Record arrays must have a unique [key] entry for identification." thrown in filamentphp/filament.

Source

Thrown at packages/tables/src/Concerns/HasRecords.php:252

     */
    public function getTableRecord(?string $key): Model | array | null
    {
        $record = $this->resolveTableRecord($key);

        if ($record && filled($this->getActiveTableLocale())) {
            $this->makeFilamentTranslatableContentDriver()->setRecordLocale($record);
        }

        return $record;
    }

    /**
     * @param  Model | array<string, mixed>  $record
     */
    public function getTableRecordKey(Model | array $record): string
    {
        if (is_array($record)) {
            return $record[ArrayRecord::getKeyName()] ?? throw new LogicException('Record arrays must have a unique [key] entry for identification.');
        }

        $table = $this->getTable();

        if (! $table->hasPivotRecordKeys()) {
            return $record->getKey();
        }

        /** @var BelongsToMany $relationship */
        $relationship = $table->getRelationship();

        $pivotClass = $relationship->getPivotClass();
        $pivotKeyName = app($pivotClass)->getKeyName();

        return $record->getAttributeValue($pivotKeyName);
    }

    public function getAllTableRecordsCount(): int

View on GitHub (pinned to 53483fa934)

When it happens

Trigger: Thrown at packages/tables/src/Concerns/HasRecords.php:252 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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