{"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/bd6b5437e6ad87bb49f9b426724f07a9f64e9683/src/Illuminate/Container/BoundMethod.php#L45-L81","documentation":"Thrown by BoundMethod::callClass when a Class@method string passed to Container::call contains only a class name (no '@method' segment) and no defaultMethod was supplied and the class has no __invoke method. Laravel needs a method to invoke and cannot guess it, so it raises InvalidArgumentException('Method not provided.').","triggerScenarios":"Calling $container->call('App\\Services\\InvoiceService') with no @method and no third $defaultMethod argument, where InvoiceService has no __invoke. Also Scheduler/Job dispatch code that resolves 'Class' instead of 'Class@handle'.","commonSituations":"Passing a job class string to dispatch helpers that expect Class@method or a callable array; typo dropping the @method portion; refactoring an invokable class into a non-invokable one without updating callers; queued closures converted to class strings.","solutions":["Provide the method explicitly: $container->call('App\\Services\\InvoiceService@process') or use array form [$instance, 'process'].","Pass the defaultMethod argument: $container->call($class, [], 'handle').","If the class is meant to be invoked, implement __invoke on it (the container auto-detects __invoke when no method is given).","Switch to a Closure or [object, method] callable to remove ambiguity."],"exampleFix":"// before\napp()->call(App\\Services\\ReportService::class);\n\n// after\napp()->call([app(ReportService::class), 'generate']);\n// or\napp()->call(ReportService::class, [], 'generate');","handlingStrategy":"validation","validationCode":"if (is_string($callback) && ! str_contains($callback, '@')\n    && ! method_exists($callback, '__invoke')) {\n    throw new \\InvalidArgumentException(\"{$callback} needs '@method' or an __invoke method\");\n}\napp()->call($callback, $params);","typeGuard":"function isCallableMethodSpec(string|callable $callback): bool\n{\n    if (! is_string($callback)) return true;\n    return str_contains($callback, '@') || method_exists($callback, '__invoke');\n}","tryCatchPattern":"try {\n    app()->call($callback, $params);\n} catch (\\InvalidArgumentException $e) {\n    if ($e->getMessage() === 'Method not provided.') {\n        app()->call($callback, $params, 'handle');\n    } else { throw $e; }\n}","preventionTips":["Always pass Class@method or [instance, method] arrays.","Implement __invoke on classes used as single-method services.","Document the expected callable shape in your dispatcher's docblock."],"tags":["container","method-call","di","invoke"],"analyzedSha":"bd6b5437e6ad87bb49f9b426724f07a9f64e9683","analyzedAt":"2026-08-06T00:28:32.783Z","schemaVersion":2}