{"id":"e867acadebd7ad78","repo":"laravel/framework","slug":"method-run-missing-from-class","errorCode":null,"errorMessage":"Method [run] missing from {class}","messagePattern":"Method \\[run\\] missing from (.+?)","errorType":"exception","errorClass":"InvalidArgumentException","httpStatus":null,"severity":"error","filePath":"src/Illuminate/Database/Seeder.php","lineNumber":180,"sourceCode":"    public function setCommand(Command $command)\n    {\n        $this->command = $command;\n\n        return $this;\n    }\n\n    /**\n     * Run the database seeds.\n     *\n     * @param  array  $parameters\n     * @return mixed\n     *\n     * @throws \\InvalidArgumentException\n     */\n    public function __invoke(array $parameters = [])\n    {\n        if (! method_exists($this, 'run')) {\n            throw new InvalidArgumentException('Method [run] missing from '.get_class($this));\n        }\n\n        $callback = fn () => isset($this->container)\n            ? $this->container->call([$this, 'run'], $parameters)\n            : $this->run(...$parameters);\n\n        if (isset(class_uses_recursive(static::class)[WithoutModelEvents::class])) {\n            $callback = $this->withoutModelEvents($callback);\n        }\n\n        return $callback();\n    }\n}\n","sourceCodeStart":162,"sourceCodeEnd":194,"githubUrl":"https://github.com/laravel/framework/blob/bd6b5437e6ad87bb49f9b426724f07a9f64e9683/src/Illuminate/Database/Seeder.php#L162-L194","documentation":"Seeder.__invoke() requires every seeder class to define a run() method — that is the contract entry point the framework calls. If method_exists($this, 'run') is false, InvalidArgumentException is thrown before any work begins. The exception names the offending class so you can locate it.","triggerScenarios":"Calling $this->call(SomeSeeder::class) or invoking a seeder (via db:seed or DatabaseSeeder) where SomeSeeder has no run() method — e.g. a class extending Seeder that only defines a helper method, or a typo (run vs Run, or a class used as a base/abstract without being meant to seed).","commonSituations":"Forgot to add run() after generating a seeder; renamed run() to something else; an abstract base seeder class being invoked directly; a seeder class that only defines call() invocations inside the wrong method name; namespace/class autoload mismatch loading an empty stub.","solutions":["Add a public function run(): void { ... } method to the seeder class named in the message.","Check for typos: the method must be exactly 'run' (case-sensitive).","Ensure you are calling the intended concrete seeder, not an abstract base class.","Run composer dump-autoload to clear a stale class map pointing at a stub."],"exampleFix":"// before\nnamespace Database\\Seeders;\nclass UserSeeder extends Seeder\n{\n    public function seed(): void\n    {\n        User::factory(10)->create();\n    }\n}\n\n// after\nnamespace Database\\Seeders;\nclass UserSeeder extends Seeder\n{\n    public function run(): void\n    {\n        User::factory(10)->create();\n    }\n}","handlingStrategy":"validation","validationCode":"$class = \\Database\\Seeders\\UserSeeder::class;\nif (! method_exists($class, 'run')) {\n    throw new \\LogicException(\"{$class} must implement run()\");\n}\n$this->call($class);","typeGuard":"/** @param class-string $seeder */\nfunction isValidSeeder(string $seeder): bool\n{\n    return method_exists($seeder, 'run');\n}","tryCatchPattern":null,"preventionTips":["Every seeder class must define public function run().","Use php artisan make:seeder to get the correct stub.","Do not invoke abstract/base seeder classes directly."],"tags":["database","seeding","laravel-contract","configuration"],"analyzedSha":"bd6b5437e6ad87bb49f9b426724f07a9f64e9683","analyzedAt":"2026-08-06T00:28:32.783Z","schemaVersion":2}