{"record":{"id":"f2a873f97b0604b5","repo":"HKUDS/DeepTutor","slug":"invalid-book-id-book-id-r-f2a873","errorCode":null,"errorMessage":"Invalid book_id: {book_id!r}","messagePattern":"Invalid book_id: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"deeptutor/learning/storage.py","lineNumber":270,"sourceCode":"        self._root = root or (get_path_service().get_workspace_dir() / \"learning\")\n        self._root.mkdir(parents=True, exist_ok=True)\n        self._initialized = False\n        self._ensure_initialized()\n\n    @property\n    def db_path(self) -> Path:\n        return Path(self._root) / self._DB_FILENAME\n\n    def _path(self, book_id: str) -> Path:\n        \"\"\"Return the legacy JSON location after validating the public id.\"\"\"\n        self._validate_id(book_id)\n        return Path(self._root) / f\"{book_id}.json\"\n\n    @staticmethod\n    def _validate_id(book_id: str) -> str:\n        value = str(book_id or \"\")\n        if not value or \"/\" in value or \"\\\\\" in value or \"..\" in value or \":\" in value:\n            raise ValueError(f\"Invalid book_id: {book_id!r}\")\n        return value\n\n    def _ensure_initialized(self) -> None:\n        db_path = self.db_path.resolve()\n        if self.db_path.exists() and (\n            getattr(self, \"_initialized\", False) or db_path in _initialized_db_paths\n        ):\n            self._initialized = True\n            return\n        with _schema_lock:\n            if self.db_path.exists() and db_path in _initialized_db_paths:\n                self._initialized = True\n                return\n            Path(self._root).mkdir(parents=True, exist_ok=True)\n            with self._connect(initialize=False) as conn:\n                conn.executescript(\n                    \"\"\"\n                    PRAGMA journal_mode = WAL;","sourceCodeStart":252,"sourceCodeEnd":288,"githubUrl":"https://github.com/HKUDS/DeepTutor/blob/3e82f130422a813cdd73c10b21a44e9325f5821a/deeptutor/learning/storage.py#L252-L288","documentation":"Error \"Invalid book_id: {book_id!r}\" thrown in HKUDS/DeepTutor.","triggerScenarios":"Thrown at deeptutor/learning/storage.py:270 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3e82f130422a813cdd73c10b21a44e9325f5821a","analyzedAt":"2026-08-27T06:57:25.364Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}