{"record":{"id":"7045106897627337","repo":"laravel/framework","slug":"id","errorCode":null,"errorMessage":"{$id}","messagePattern":"\\{\\$id\\}","errorType":"exception","errorClass":"EntryNotFoundException","httpStatus":null,"severity":"error","filePath":"src/Illuminate/Container/Container.php","lineNumber":888,"sourceCode":"     *\n     * @template TClass of object\n     *\n     * @param  string|class-string<TClass>  $id\n     * @return ($id is class-string<TClass> ? TClass : mixed)\n     *\n     * @throws \\Illuminate\\Contracts\\Container\\CircularDependencyException\n     * @throws \\Illuminate\\Container\\EntryNotFoundException\n     */\n    public function get(string $id)\n    {\n        try {\n            return $this->resolve($id);\n        } catch (Exception $e) {\n            if ($this->has($id) || $e instanceof CircularDependencyException) {\n                throw $e;\n            }\n\n            throw new EntryNotFoundException($id, is_int($e->getCode()) ? $e->getCode() : 0, $e);\n        }\n    }\n\n    /**\n     * Resolve the given type from the container.\n     *\n     * @template TClass of object\n     *\n     * @param  string|class-string<TClass>|callable  $abstract\n     * @param  array  $parameters\n     * @param  bool  $raiseEvents\n     * @return ($abstract is class-string<TClass> ? TClass : mixed)\n     *\n     * @throws \\Illuminate\\Contracts\\Container\\BindingResolutionException\n     * @throws \\Illuminate\\Contracts\\Container\\CircularDependencyException\n     */\n    protected function resolve($abstract, $parameters = [], $raiseEvents = true)\n    {","sourceCodeStart":870,"sourceCodeEnd":906,"githubUrl":"https://github.com/laravel/framework/blob/e0f6eb3518ac29fbbca8529e97d0df7fc9f24481/src/Illuminate/Container/Container.php#L870-L906","documentation":"EntryNotFoundException thrown by the PSR-11 Container::get($id) when $id is neither bound/resolvable in the container and resolution raised an Exception that is not a CircularDependencyException. get() re-throws original errors only when the entry is known to exist (has($id) true); otherwise it wraps the cause in EntryNotFoundException to comply with PSR-11.","triggerScenarios":"Calling $container->get('some-service-key') for a string key that was never bound; resolving a class string whose constructor dependencies cannot be satisfied and the class is not registered.","commonSituations":"Using PSR-11 get() with a service id from config that is misnamed or removed after a refactor; environment difference where a provider is registered in dev but not production; accessing a deferred-provider service before the provider loaded.","solutions":["Verify the id is bound: if ($container->has($id)) before calling get().","Register the missing binding in a service provider or confirm the provider is in config/app.php.","Switch to make() if you want autowiring of class strings rather than strict PSR-11 lookup.","Check the previous exception ($e->getPrevious()) for the underlying cause of the resolution failure."],"exampleFix":"// before\n$svc = $container->get('billing.gateway');\n// after\nif (! $container->has('billing.gateway')) {\n    throw new RuntimeException('billing.gateway not registered');\n}\n$svc = $container->get('billing.gateway');","handlingStrategy":"validation","validationCode":"// PSR-11 safe lookup\n$id = 'billing.gateway';\nif (! $container->has($id)) {\n    throw new RuntimeException(\"Service [$id] is not registered in the container.\");\n}\n$service = $container->get($id);","typeGuard":"// Use has() as the narrowing guard before get().\nassert($container->has($id));\n$service = $container->get($id);","tryCatchPattern":"use Illuminate\\Container\\EntryNotFoundException;\n\ntry {\n    $service = $container->get($id);\n} catch (EntryNotFoundException $e) {\n    // inspect $e->getPrevious() for the real cause; register the binding or fix the id\n    throw $e;\n}","preventionTips":["Prefer make() for autowiring class strings; reserve get() for explicitly bound keys.","Always pair get($id) with a has($id) check in library code consuming PSR-11.","Register deferred-provider services before first use or rely on the framework's boot order."],"tags":["container","psr-11","di","configuration"],"backgroundTag":null,"analyzedSha":"e0f6eb3518ac29fbbca8529e97d0df7fc9f24481","analyzedAt":"2026-08-11T20:52:37.562Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}