{"id":"26885581b3827216","repo":"laravel/framework","slug":"property-offset-does-not-exist","errorCode":null,"errorMessage":"Property {$offset} does not exist.","messagePattern":"Property (.+?) does not exist\\.","errorType":"exception","errorClass":"InvalidArgumentException","httpStatus":null,"severity":"warning","filePath":"src/Illuminate/Database/Eloquent/ModelInfo.php","lineNumber":95,"sourceCode":"        ];\n    }\n\n    /**\n     * Determine if the given offset exists.\n     */\n    public function offsetExists(mixed $offset): bool\n    {\n        return property_exists($this, $offset);\n    }\n\n    /**\n     * Get the value for a given offset.\n     *\n     * @throws \\InvalidArgumentException\n     */\n    public function offsetGet(mixed $offset): mixed\n    {\n        return property_exists($this, $offset) ? $this->{$offset} : throw new InvalidArgumentException(\"Property {$offset} does not exist.\");\n    }\n\n    /**\n     * Set the value at the given offset.\n     *\n     * @throws \\LogicException\n     */\n    public function offsetSet(mixed $offset, mixed $value): void\n    {\n        throw new LogicException(self::class.' may not be mutated using array access.');\n    }\n\n    /**\n     * Unset the value at the given offset.\n     *\n     * @throws \\LogicException\n     */\n    public function offsetUnset(mixed $offset): void","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/laravel/framework/blob/bd6b5437e6ad87bb49f9b426724f07a9f64e9683/src/Illuminate/Database/Eloquent/ModelInfo.php#L77-L113","documentation":"ModelInfo is a read-only Arrayable DTO exposing introspection data about a model (class, table, attributes, relations, etc.). offsetGet() checks property_exists($this, $offset) and throws InvalidArgumentException if the offset is not one of the known public properties, because there is nothing meaningful to return.","triggerScenarios":"Accessing an unknown key via array syntax on a ModelInfo instance returned by Model::observe()/introspection helpers, e.g. $info['nonexistent'] or $info['invalidKey'].","commonSituations":"Iterating or dynamic key access over ModelInfo with a typo'd or unsupported property name; assuming ModelInfo exposes arbitrary model attributes (it only exposes fixed introspection fields).","solutions":["Use only documented property keys (class, database, table, policy, attributes, relations, events, observers, collection, builder, resource).","Use offsetExists($key) or isset($info[$key]) before accessing.","Use $info->toArray() and read from the resulting array if you need flexible key access."],"exampleFix":"// before\n$info['attributez']; // typo\n\n// after\n$info['attributes'];\n// or guarded:\nif (isset($info['attributes'])) { ... }","handlingStrategy":"type-guard","validationCode":"if (! isset($info[$offset])) {\n    throw new \\InvalidArgumentException(\"Unknown ModelInfo key: {$offset}\");\n}\nreturn $info[$offset];","typeGuard":"function infoHas(\\Illuminate\\Database\\Eloquent\\ModelInfo $info, string $key): bool {\n    return isset($info[$key]);\n}","tryCatchPattern":null,"preventionTips":["Use only documented ModelInfo keys.","Prefer isset($info[$key]) before array access.","Read via toArray() when key access is dynamic."],"tags":["eloquent","introspection","arrayaccess","read-only"],"analyzedSha":"bd6b5437e6ad87bb49f9b426724f07a9f64e9683","analyzedAt":"2026-08-06T00:28:32.783Z","schemaVersion":2}