{"record":{"id":"40626ea02140554a","repo":"searxng/searxng","slug":"only-select-query-is-supported-40626e","errorCode":null,"errorMessage":"only SELECT query is supported","messagePattern":"only SELECT query is supported","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"searx/engines/sqlite.py","lineNumber":74,"sourceCode":"database = \"\"\n\"\"\"Filename of the SQLite DB.\"\"\"\n\nquery_str = \"\"\n\"\"\"SQL query that returns the result items.\"\"\"\n\nresult_type: t.Literal[\"MainResult\", \"KeyValue\"] = \"KeyValue\"\n\"\"\"The result type can be :py:obj:`MainResult` or :py:obj:`KeyValue`.\"\"\"\n\nlimit = 10\npaging = True\n\n\ndef init(engine_settings):\n    if 'query_str' not in engine_settings:\n        raise ValueError('query_str cannot be empty')\n\n    if not engine_settings['query_str'].lower().startswith('select '):\n        raise ValueError('only SELECT query is supported')\n\n\n@contextlib.contextmanager\ndef sqlite_cursor():\n    \"\"\"Implements a :py:obj:`Context Manager <contextlib.contextmanager>` for a\n    :py:obj:`sqlite3.Cursor`.\n\n    Open database in read only mode: if the database doesn't exist.  The default\n    mode creates an empty file on the file system.  See:\n\n    * https://docs.python.org/3/library/sqlite3.html#sqlite3.connect\n    * https://www.sqlite.org/uri.html\n\n    \"\"\"\n    uri = 'file:' + database + '?mode=ro'\n    with contextlib.closing(sqlite3.connect(uri, uri=True)) as connect:\n        connect.row_factory = sqlite3.Row\n        with contextlib.closing(connect.cursor()) as cursor:","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/searxng/searxng/blob/9fea41204fdfa7a5cfa15b0ebd12904c520478ce/searx/engines/sqlite.py#L56-L92","documentation":"Error \"only SELECT query is supported\" thrown in searxng/searxng.","triggerScenarios":"Thrown at searx/engines/sqlite.py:74 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":"9fea41204fdfa7a5cfa15b0ebd12904c520478ce","analyzedAt":"2026-08-27T06:40:00.395Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}