infiniflow/ragflow · error · Exception

For Trino, `database` must be 'catalog.schema' or at least '

Error message

For Trino, `database` must be 'catalog.schema' or at least 'catalog'.

What it means

Error "For Trino, `database` must be 'catalog.schema' or at least 'catalog'." thrown in infiniflow/ragflow.

Source

Thrown at agent/tools/exesql.py:166

                import trino
                from trino.auth import BasicAuthentication
            except Exception:
                raise Exception("Missing dependency 'trino'. Please install: pip install trino")

            def _parse_catalog_schema(db: str):
                if not db:
                    return None, None
                if "." in db:
                    c, s = db.split(".", 1)
                elif "/" in db:
                    c, s = db.split("/", 1)
                else:
                    c, s = db, "default"
                return c, s

            catalog, schema = _parse_catalog_schema(self._param.database)
            if not catalog:
                raise Exception("For Trino, `database` must be 'catalog.schema' or at least 'catalog'.")

            http_scheme = "https" if os.environ.get("TRINO_USE_TLS", "0") == "1" else "http"
            auth = None
            if http_scheme == "https" and self._param.password:
                auth = BasicAuthentication(self._param.username, self._param.password)

            try:
                db = trino.dbapi.connect(
                    host=safe_host, port=int(self._param.port or 8080), user=self._param.username or "ragflow", catalog=catalog, schema=schema or "default", http_scheme=http_scheme, auth=auth
                )
            except Exception as e:
                raise Exception("Database Connection Failed! \n" + str(e))
        elif self._param.db_type == "IBM DB2":
            import ibm_db

            conn_str = f"DATABASE={self._param.database};HOSTNAME={safe_host};PORT={self._param.port};PROTOCOL=TCPIP;UID={self._param.username};PWD={self._param.password};"
            try:
                conn = ibm_db.connect(conn_str, "", "")

View on GitHub (pinned to 554fb1133a)

Solutions

  1. Set the database parameter to 'catalog' or 'catalog.schema' form for Trino.

Example fix

database = 'hive.analytics'

When it happens

Trigger: Thrown at agent/tools/exesql.py:166 when the library encounters an invalid state.

Common situations: A Trino connection is configured with a plain database name; Trino requires catalog[.schema] addressing, so updating the database field prevents this error.


AI-assisted analysis of infiniflow/ragflow@554fb1133a (2026-08-15). Data as JSON: /api/errors/820d494d326110b5. Report an issue: GitHub.