Skip to main content

CAP.L0.PRETEND_ERROR — Error during the pretend run

  • Category: safety
  • Level: 0
  • Stability: stable
  • Suites: lint

The migration threw while it was being captured under pretend, so its SQL could not be linted. The capture does not let one throwing migration crash the whole run; it records the failure with the exception message and moves on, and this rule turns that recorded failure into a reported finding so it is never lost.

The finding carries the exception message (with any absolute path relativized, so the same error reads identically on every machine) but never a stack trace. Fix the error the migration raises — a typo, a missing class, a bad call — and it will capture normally.

Flagged

public function up(): void
{
// A typo, a missing class, a bad call — this throws under pretend,
// so its SQL can never be captured and the migration cannot be linted.
Schema::create('users', fn (Blueprint $table) => $table->nonexistentType('x'));
}

Preferred

public function up(): void
{
Schema::create('users', function (Blueprint $table): void {
$table->id();
$table->string('email');
});
}