{"record":{"id":"c2be48dd70a74579","repo":"getgrav/grav","slug":"identifier-s-is-not-defined","errorCode":null,"errorMessage":"Identifier \"%s\" is not defined.","messagePattern":"Identifier \"(.+?)\" is not defined\\.","errorType":"exception","errorClass":"Pimple\\Exception\\UnknownIdentifierException","httpStatus":null,"severity":"error","filePath":"system/src/Pimple/Container.php","lineNumber":130,"sourceCode":"    }\n\n    /**\n     * Gets a parameter or an object.\n     *\n     * @param string $id The unique identifier for the parameter or object\n     *\n     * @return mixed The value of the parameter or an object\n     *\n     * @throws UnknownIdentifierException If the identifier is not defined\n     */\n    public function offsetGet(mixed $id): mixed\n    {\n        if (!is_string($id)) {\n            throw new InvalidServiceIdentifierException($id);\n        }\n\n        if (!isset($this->keys[$id])) {\n            throw new UnknownIdentifierException($id);\n        }\n\n        if (\n            isset($this->raw[$id])\n            || !is_object($this->values[$id])\n            || isset($this->protected[$this->values[$id]])\n            || !method_exists($this->values[$id], '__invoke')\n        ) {\n            return $this->values[$id];\n        }\n\n        if (isset($this->factories[$this->values[$id]])) {\n            return $this->values[$id]($this);\n        }\n\n        $raw = $this->values[$id];\n        $val = $this->values[$id] = $raw($this);\n        $this->raw[$id] = $raw;","sourceCodeStart":112,"sourceCodeEnd":148,"githubUrl":"https://github.com/getgrav/grav/blob/6040efed04efa69b8209448ed81308e7c24147c2/system/src/Pimple/Container.php#L112-L148","documentation":"Pimple throws UnknownIdentifierException from Container::offsetGet() when the requested string ID has never been registered. Retrieval does not create a default value; the keys map is populated only by offsetSet(), the constructor, or a service provider.","triggerScenarios":"Executing $container['twigg'] for a service registered as 'twig', fetching a service before its provider has registered it, or requesting an ID that only exists in a different Pimple container or ServiceLocator whitelist.","commonSituations":"Typos and case differences in Grav service names, a plugin expecting another plugin's service without checking availability, initialization-order bugs, or calling container code with IDs loaded from an outdated configuration file.","solutions":["Correct the service name to the exact registered string.","Call isset($container[$id]) or in_array($id, $container->keys(), true) before dynamic access.","Register the missing ID before it is requested.","If using a PSR-11 ServiceLocator, ensure the ID was included in its constructor whitelist rather than assuming the full container is available."],"exampleFix":"// before\n$service = $container['assetss']; // typo, not defined\n\n// after\n$id = 'assets';\nif (!isset($container[$id])) {\n    throw new LogicException(sprintf('Service \"%s\" is not registered; available: %s', $id, implode(', ', $container->keys())));\n}\n$service = $container[$id];","handlingStrategy":"validation","validationCode":"if (!isset($container[$id])) {\n    throw new LogicException(sprintf('Service \"%s\" is not registered. Defined: %s', $id, implode(', ', $container->keys())));\n}\n$service = $container[$id];","typeGuard":null,"tryCatchPattern":"try {\n    $service = $container[$id];\n} catch (UnknownIdentifierException $e) {\n    if ($optional) {\n        return $default;\n    }\n    throw $e;\n}","preventionTips":["Use exact service-name constants shared by producers and consumers.","Check isset() before every dynamic service lookup.","Do not assume third-party services are registered; make dependencies explicit.","Assert required IDs during bootstrap rather than catching at request time."],"tags":["pimple","dependency-injection","php","unknown-service","typo"],"backgroundTag":"unknown-service-identifier","analyzedSha":"6040efed04efa69b8209448ed81308e7c24147c2","analyzedAt":"2026-08-17T05:07:31.593Z","schemaVersion":2},"datasetVersion":"2026-08-17T09:17:11.063Z"}