{"record":{"id":"f1847c566b93e92a","repo":"laravel/framework","slug":"method-not-provided","errorCode":null,"errorMessage":"Method not provided.","messagePattern":"Method not provided\\.","errorType":"exception","errorClass":"InvalidArgumentException","httpStatus":null,"severity":"error","filePath":"src/Illuminate/Container/BoundMethod.php","lineNumber":63,"sourceCode":"     * @param  array  $parameters\n     * @param  string|null  $defaultMethod\n     * @return mixed\n     *\n     * @throws \\InvalidArgumentException\n     */\n    protected static function callClass($container, $target, array $parameters = [], $defaultMethod = null)\n    {\n        $segments = explode('@', $target);\n\n        // We will assume an @ sign is used to delimit the class name from the method\n        // name. We will split on this @ sign and then build a callable array that\n        // we can pass right back into the \"call\" method for dependency binding.\n        $method = count($segments) === 2\n            ? $segments[1]\n            : $defaultMethod;\n\n        if (is_null($method)) {\n            throw new InvalidArgumentException('Method not provided.');\n        }\n\n        return static::call(\n            $container,\n            [$container->make($segments[0]), $method],\n            $parameters\n        );\n    }\n\n    /**\n     * Call a method that has been bound to the container.\n     *\n     * @param  \\Illuminate\\Container\\Container  $container\n     * @param  callable  $callback\n     * @param  mixed  $default\n     * @return mixed\n     */\n    protected static function callBoundMethod($container, $callback, $default)","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/laravel/framework/blob/e0f6eb3518ac29fbbca8529e97d0df7fc9f24481/src/Illuminate/Container/BoundMethod.php#L45-L81","documentation":"Thrown by BoundMethod::callClass() when a Class@method-style target string is resolved but neither the @method segment nor a fallback defaultMethod is available. The container uses the @ sign to split a class name from the method to invoke; if there is no @ and no default, there is nothing callable. This is the framework's way of refusing to guess which method to dispatch.","triggerScenarios":"Calling Container::call('App\\Http\\Controllers\\UserController') (no @method) without a defaultMethod argument; registering a route as a bare controller string without an action; dispatching a job/queued listener whose handler string omits the method suffix.","commonSituations":"Route definitions like Route::get('users', 'UserController') missing '@index'; refactoring a controller and forgetting to update a Container::call() target; queue config referencing 'Class' instead of 'Class@handle'; typo dropping the @method portion.","solutions":["Append the method name using Class@method syntax, e.g. 'UserController@index'.","If calling Container::call() directly, pass the defaultMethod as the 4th argument so it is used when no @ is present.","Pass a proper callable array [$instance, 'method'] or a Closure instead of a string target.","Search the codebase for the exact controller/class string and verify every usage includes the method."],"exampleFix":"// before\nContainer::call('App\\Services\\ReportGenerator');\n// after\nContainer::call('App\\Services\\ReportGenerator@generate');\n// or\nContainer::call('App\\Services\\ReportGenerator', [], 'generate');","handlingStrategy":"validation","validationCode":"// Before calling a Class@method target, ensure it is well-formed.\nfunction ensureCallableTarget(string $target, ?string $defaultMethod = null): void\n{\n    $segments = explode('@', $target);\n    if (count($segments) !== 2 && $defaultMethod === null) {\n        throw new InvalidArgumentException(\"Target [$target] must be 'Class@method' or a default method must be supplied.\");\n    }\n}\n\nensureCallableTarget($target, $defaultMethod);\n$result = Container::call($target, $params, $defaultMethod);","typeGuard":"function isClassAtMethodTarget(string $target): bool\n{\n    return count(explode('@', $target)) === 2;\n}","tryCatchPattern":"try {\n    Container::call($target, $params, $defaultMethod);\n} catch (\\InvalidArgumentException $e) {\n    if (str_contains($e->getMessage(), 'Method not provided')) {\n        // fix the target string to Class@method and retry / report\n    }\n    throw $e;\n}","preventionTips":["Always use Class@method syntax for string-based container/route dispatch targets.","In tests, assert that route/controller action strings contain an '@'.","Lint service-provider and route files for bare controller FQCNs without a method."],"tags":["container","routing","di","configuration"],"backgroundTag":null,"analyzedSha":"e0f6eb3518ac29fbbca8529e97d0df7fc9f24481","analyzedAt":"2026-08-11T20:52:37.562Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}