{"record":{"id":"2499590867befcbc","repo":"phalcon/cphalcon","slug":"the-index-does-not-exist-in-the-cursor","errorCode":null,"errorMessage":"The index does not exist in the cursor","messagePattern":"The index does not exist in the cursor","errorType":"exception","errorClass":"Phalcon\\Mvc\\Model\\Exceptions\\IndexNotInCursor","httpStatus":null,"severity":"error","filePath":"phalcon/Mvc/Model/Resultset.zep","lineNumber":601,"sourceCode":"            this->pointer + 1\n        );\n    }\n\n    /**\n     * Checks whether offset exists in the resultset\n     */\n    public function offsetExists(var index) -> bool\n    {\n        return index < this->count();\n    }\n\n    /**\n     * Gets row in a specific position of the resultset\n     */\n    public function offsetGet(mixed index) -> mixed\n    {\n        if unlikely index >= this->count() {\n            throw new IndexNotInCursor();\n        }\n\n        /**\n         * Move the cursor to the specific position\n         */\n        this->seek(index);\n\n        return this->{\"current\"}();\n    }\n\n    /**\n     * Resultsets cannot be changed. It has only been implemented to meet the definition of the ArrayAccess interface\n     *\n     * @param int offset\n     * @param \\Phalcon\\Mvc\\ModelInterface value\n     */\n    public function offsetSet(var offset, var value) -> void\n    {","sourceCodeStart":583,"sourceCodeEnd":619,"githubUrl":"https://github.com/phalcon/cphalcon/blob/b7419de9cd0a8a3f48441ead84c9f8415d463e25/phalcon/Mvc/Model/Resultset.zep#L583-L619","documentation":"Guard in Resultset::offsetGet (ArrayAccess): the requested offset is >= the resultset count, so the cursor has no row at that index. The input at fault is an out-of-range index passed via $resultset[$i] or offsetGet().","triggerScenarios":"Thrown at phalcon/Mvc/Model/Resultset.zep:601 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check $resultset->offsetExists($i) or count($resultset) before accessing an index.","Use foreach or valid()/seek() iteration instead of random access with unknown indexes.","Clamp or validate user-supplied page/offset values before indexing."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b7419de9cd0a8a3f48441ead84c9f8415d463e25","analyzedAt":"2026-08-21T06:21:18.811Z","contentChangedAt":"2026-08-21T06:21:18.811Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}