typeorm/typeorm · error · TypeORMError

Stream is not supported by sqlite driver.

Error message

Stream is not supported by sqlite driver.

What it means

Thrown by AbstractSqliteQueryRunner.stream because the sqlite driver family does not support streaming query results via the stream() API. SQLite returns rows as a single result set; there is no cursor/streaming primitive exposed. The method throws synchronously regardless of arguments.

Source

Thrown at src/driver/sqlite-abstract/AbstractSqliteQueryRunner.ts:179

        await this.broadcaster.broadcast("AfterTransactionRollback")
    }

    /**
     * Returns raw data stream.
     *
     * @param query
     * @param parameters
     * @param onEnd
     * @param onError
     */
    stream(
        query: string,
        parameters?: any[],
        onEnd?: Function,
        onError?: Function,
    ): Promise<ReadStream> {
        throw new TypeORMError(`Stream is not supported by sqlite driver.`)
    }

    /**
     * Returns all available database names including system databases.
     */
    async getDatabases(): Promise<string[]> {
        return Promise.resolve([])
    }

    /**
     * Returns all available schema names including system schemas.
     * If database parameter specified, returns schemas of that database.
     *
     * @param database
     */
    async getSchemas(database?: string): Promise<string[]> {
        return Promise.resolve([])
    }

View on GitHub (pinned to 04ff4daedc)

Solutions

  1. Replace streaming with batched iteration: use .find({ skip, take }) or queryBuilder .skip/.take pagination, or .getRawMany() with manual chunking on sqlite.
  2. Gate the stream call by driver: only stream when dataSource.options.type supports it.
  3. For large exports, stream from application-level paging instead of DB-level cursors on sqlite.
  4. If you only need streaming in tests, run those tests against a stream-capable driver.

Example fix

// before
const stream = await dataSource
  .getRepository(User)
  .createQueryBuilder()
  .stream()

// after (sqlite-compatible paging)
const PAGE = 1000
let skip = 0
let rows: User[]
do {
  rows = await dataSource.getRepository(User).find({ skip, take: PAGE })
  // process rows
  skip += PAGE
} while (rows.length === PAGE)
Defensive patterns

Strategy: validation

Validate before calling

function supportsStream(ds: DataSource): boolean {
  return !['sqlite', 'better-sqlite3', 'sqljs', 'react-native'].includes(ds.options.type as string)
}

Type guard

function driverSupportsStream(ds: DataSource): boolean {
  return supportsStream(ds)
}

Prevention

When it happens

Trigger: Calling `await dataSource.getRepository(User).createQueryBuilder().stream()` or `queryRunner.stream(sql, params)` on a sqlite DataSource. Also any code that generically calls .stream() across drivers.

Common situations: Portable/shared repository code that streams large result sets on Postgres and is reused on sqlite (e.g. tests or a local-dev sqlite profile). Generic export/ETL helpers that always stream.

Related errors


AI-assisted analysis of typeorm/typeorm@04ff4daedc (2026-08-03). Data as JSON: /data/errors/658191df5c1c9904.json. Report an issue: GitHub.