Undefined array key "recordId"

I read this thread:
❓┊helpError "Undefined array key "recordId"

but couldn't find a solution for my problem, even if it's the same error.
The error is appearing when i try to save.

my headerActions code is:

            ->headerActions([
                Tables\Actions\AttachAction::make()
                    ->label('Legg til øvelse i program')
                    ->recordSelect(fn () => Select::make('exercise_name')
                        ->searchable()
                        ->preload()
                        ->createOptionForm([
                            Forms\Components\TextInput::make('exercise_name'),
                        ])
                        ->createOptionUsing(function ($data){
                            $exercise = WorkoutExercise::create($data);
                            return $exercise->getKey();
                        })
                        ->options(WorkoutExercise::pluck('exercise_name', 'id'))
                    )
                    ->form(fn (AttachAction $action): array => [
                        $action->getRecordSelect(),
                        Forms\Components\TextInput::make('repetitions')->required(),
                        Forms\Components\TextInput::make('sets')->required(),
                        Forms\Components\TimePicker::make('rest')
                            ->native(false)
                            ->secondsStep(10)
                            ->displayFormat('i:s')
                            ->format('H:i:s')
                            ->required(),
                    ])
            ])


where have i messed up?
Solution
Figured it out.

This:
->recordSelect(fn () => Select::make('exercise_name')


has to be this:
->recordSelect(fn () => Select::make('recordId')
Was this page helpful?