Shift with red gradient lettering Skip to content

Common Errors

Composer: Ambiguous class resolution

Warning: Ambiguous class resolution, "MigrationFactorySeeder" was found in both "/laravel/app/database/migrations/MigrationFactorySeeder.php" and "/laravel/app/database/seeds/MigrationFactorySeeder.php", the first will be used.

Issue

When folders use a classmap for autoloading it is possible for classes to conflict even though they may be stored in different folders. Prior to version 8, Laravel loaded the database/factories and database/seeds via a classmap. It also loads the database/migrations folder internally.

Solution

You must ensure any classes within folders autoloaded by a classmap have a distinct class name. Within Laravel, consider following the convention of suffixing the class name with a type (e.g. Factory or Seeder).