{"record":{"id":"c2765ee2ad3aa98a","repo":"sansan0/TrendRadar","slug":"schema-file-not-found-schema-path","errorCode":null,"errorMessage":"Schema file not found: {schema_path}","messagePattern":"Schema file not found: (.+?)","errorType":"exception","errorClass":"FileNotFoundError","httpStatus":null,"severity":"error","filePath":"trendradar/storage/sqlite_mixin.py","lineNumber":90,"sourceCode":"        \"\"\"获取 AI 筛选 schema 文件路径\"\"\"\n        return Path(__file__).parent / \"ai_filter_schema.sql\"\n\n    def _init_tables(self, conn: sqlite3.Connection, db_type: str = \"news\") -> None:\n        \"\"\"\n        从 schema.sql 初始化数据库表结构\n\n        Args:\n            conn: 数据库连接\n            db_type: 数据库类型 (\"news\" 或 \"rss\")\n        \"\"\"\n        schema_path = self._get_schema_path(db_type)\n\n        if schema_path.exists():\n            with open(schema_path, \"r\", encoding=\"utf-8\") as f:\n                schema_sql = f.read()\n            conn.executescript(schema_sql)\n        else:\n            raise FileNotFoundError(f\"Schema file not found: {schema_path}\")\n\n        # news 库额外加载 AI 筛选表结构\n        if db_type == \"news\":\n            ai_filter_schema = self._get_ai_filter_schema_path()\n            if ai_filter_schema.exists():\n                with open(ai_filter_schema, \"r\", encoding=\"utf-8\") as f:\n                    conn.executescript(f.read())\n\n        if db_type == \"rss\":\n            self._migrate_rss_schema(conn)\n\n        conn.commit()\n\n    def _migrate_rss_schema(self, conn: sqlite3.Connection) -> None:\n        \"\"\"迁移 rss_items 表结构（为已有数据库添加 guid 列）\"\"\"\n        cursor = conn.execute(\"PRAGMA table_info(rss_items)\")\n        columns = {row[1] for row in cursor.fetchall()}\n        if \"guid\" not in columns:","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/sansan0/TrendRadar/blob/8ee26026ba6c11dec41a95fb3895a7162876caa1/trendradar/storage/sqlite_mixin.py#L72-L108","documentation":"Error \"Schema file not found: {schema_path}\" thrown in sansan0/TrendRadar.","triggerScenarios":"Thrown at trendradar/storage/sqlite_mixin.py:90 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["确认 schema SQL 文件存在于预期路径","检查安装包是否完整，必要时重新安装以恢复缺失的 schema 文件","确认 db_type 配置正确，使 _get_schema_path 解析到正确路径"],"exampleFix":"ls trendradar/storage/schema/*.sql  # 确认 schema 文件存在","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"8ee26026ba6c11dec41a95fb3895a7162876caa1","analyzedAt":"2026-08-15T01:42:18.084Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}