{"record":{"id":"53a6956203fd5ccd","repo":"laravel/framework","slug":"target-concrete-is-not-instantiable","errorCode":null,"errorMessage":"Target [$concrete] is not instantiable.","messagePattern":"Target \\[\\$concrete\\] is not instantiable\\.","errorType":"exception","errorClass":"BindingResolutionException","httpStatus":null,"severity":"error","filePath":"src/Illuminate/Container/Container.php","lineNumber":1436,"sourceCode":"    /**\n     * Throw an exception that the concrete is not instantiable.\n     *\n     * @param  string  $concrete\n     * @return void\n     *\n     * @throws \\Illuminate\\Contracts\\Container\\BindingResolutionException\n     */\n    protected function notInstantiable($concrete)\n    {\n        if (! empty($this->buildStack)) {\n            $previous = implode(', ', $this->buildStack);\n\n            $message = \"Target [$concrete] is not instantiable while building [$previous].\";\n        } else {\n            $message = \"Target [$concrete] is not instantiable.\";\n        }\n\n        throw new BindingResolutionException($message);\n    }\n\n    /**\n     * Throw an exception for an unresolvable primitive.\n     *\n     * @return void\n     *\n     * @throws \\Illuminate\\Contracts\\Container\\BindingResolutionException\n     */\n    protected function unresolvablePrimitive(ReflectionParameter $parameter)\n    {\n        $message = \"Unresolvable dependency resolving [$parameter] in class {$parameter->getDeclaringClass()->getName()}\";\n\n        throw new BindingResolutionException($message);\n    }\n\n    /**\n     * Register a new before resolving callback for all types.","sourceCodeStart":1418,"sourceCodeEnd":1454,"githubUrl":"https://github.com/laravel/framework/blob/e0f6eb3518ac29fbbca8529e97d0df7fc9f24481/src/Illuminate/Container/Container.php#L1418-L1454","documentation":"Same notInstantiable() helper as error 108, but thrown when buildStack is empty - meaning the container was asked to directly resolve/build an interface or abstract class at the top level with no registered concrete binding. There is no surrounding build chain to report.","triggerScenarios":"Calling $container->make(SomeInterface::class) or build(SomeInterface::class) with no binding; resolving an abstract key whose binding was never registered; resolving an abstract class marked abstract.","commonSituations":"Asking the service locator for a contract by its FQCN instead of the bound alias; provider that should bind the interface not loaded in the current environment (e.g. tests vs prod); interface renamed so the binding key no longer matches.","solutions":["Register a binding for the abstract: $this->app->bind(SomeInterface::class, Concrete::class).","Resolve via the alias/string key that was actually bound instead of the interface FQCN.","Confirm the service provider that performs the binding is loaded (config/app.php or package discovery).","Use make() with the concrete class directly if no polymorphism is needed."],"exampleFix":"// before\n$repo = app(MailerInterface::class); // unbound interface\n// after\n$this->app->bind(MailerInterface::class, SmtpMailer::class);\n$repo = app(MailerInterface::class);","handlingStrategy":"validation","validationCode":"// Before top-level resolution of an abstract/interface, verify it is bound.\n$abstract = SomeInterface::class;\nif (! app()->bound($abstract) && (interface_exists($abstract) || (new \\ReflectionClass($abstract))->isAbstract())) {\n    throw new RuntimeException(\"Abstract [$abstract] has no concrete binding; register it in a provider.\");\n}\napp()->make($abstract);","typeGuard":"function isDirectlyResolvable(string $abstract, \\Illuminate\\Container\\Container $c): bool\n{\n    if (interface_exists($abstract) || (class_exists($abstract) && (new \\ReflectionClass($abstract))->isAbstract())) {\n        return $c->bound($abstract);\n    }\n    return class_exists($abstract);\n}","tryCatchPattern":"use Illuminate\\Contracts\\Container\\BindingResolutionException;\n\ntry {\n    $instance = app()->make($abstract);\n} catch (BindingResolutionException $e) {\n    if (str_contains($e->getMessage(), 'is not instantiable.')) {\n        // bind the abstract or resolve the concrete class directly\n    }\n    throw $e;\n}","preventionTips":["Resolve via the bound alias/key rather than the raw interface FQCN when unsure.","Confirm service providers that bind interfaces are listed in config/app.php.","Write a container-compilation/contract test asserting every interface used is bound."],"tags":["container","di","binding","interface"],"backgroundTag":null,"analyzedSha":"e0f6eb3518ac29fbbca8529e97d0df7fc9f24481","analyzedAt":"2026-08-11T20:52:37.562Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}