{"record":{"id":"190c0c23abe90f05","repo":"odysseus-dev/odysseus","slug":"item-index-index-out-of-range","errorCode":null,"errorMessage":"Item index {index} out of range","messagePattern":"Item index (.+?) out of range","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"routes/note/note_routes.py","lineNumber":833,"sourceCode":"\n    # --- TOGGLE CHECKLIST ITEM ---\n    @router.post(\"/{note_id}/items/{index}/toggle\")\n    def toggle_item(request: Request, note_id: str, index: int):\n        user = _owner(request)\n        db = SessionLocal()\n        try:\n            note = db.query(Note).filter(Note.id == note_id).first()\n            if not note:\n                raise HTTPException(404, \"Note not found\")\n            # SECURITY: strict ownership — previously `note.owner and note.owner != user`\n            # let any user touch a row whose owner field was null/empty.\n            if user is not None and note.owner != user:\n                raise HTTPException(404, \"Note not found\")\n            if not note.items:\n                raise HTTPException(400, \"Note has no checklist items\")\n            items = json.loads(note.items)\n            if index < 0 or index >= len(items):\n                raise HTTPException(400, f\"Item index {index} out of range\")\n            items[index][\"done\"] = not items[index].get(\"done\", False)\n            note.items = json.dumps(items)\n            flag_modified(note, \"items\")\n            db.commit()\n            return {\"ok\": True, \"items\": items}\n        finally:\n            db.close()\n\n    # --- FIRE REMINDER ---\n    @router.post(\"/fire-reminder\")\n    async def fire_reminder(request: Request):\n        \"\"\"Dispatch a reminder according to user settings.\n\n        Called by the frontend when a reminder fires. Optionally generates an\n        LLM synthesis line and/or sends an email through configured SMTP.\n        Returns {synthesis, email_sent}.\n        \"\"\"\n        # Gate against anonymous callers — LLM synthesis can burn tokens.","sourceCodeStart":815,"sourceCodeEnd":851,"githubUrl":"https://github.com/odysseus-dev/odysseus/blob/f9235ebbf13f693a6fd29ce70b097f6ec83705bf/routes/note/note_routes.py#L815-L851","documentation":"Error \"Item index {index} out of range\" thrown in odysseus-dev/odysseus.","triggerScenarios":"Triggered when the corresponding server-side validation or runtime check at the recorded location rejects the request or operation and returns this error message to the caller.","commonSituations":"See trigger scenarios.","solutions":["Use an item index within the checklist's actual length.","Refresh the note to get the current checklist before indexing."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f9235ebbf13f693a6fd29ce70b097f6ec83705bf","analyzedAt":"2026-08-14T21:47:48.359Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}