dbt-labs/dbt-core · warning

dbt is currently configured to list a maximum of {{ max_resu

Error message

dbt is currently configured to list a maximum of {{ max_results_per_iter * max_iter }} objects per schema. {{ schema }} exceeds this limit. If this is expected, you may configure this limit by setting list_relations_per_page and list_relations_page_limit in your project flags. It is recommended to start by increasing list_relations_page_limit.

What it means

This warning is emitted by the Snowflake `list_relations_without_caching` macro during schema listing. When paginated SHOW OBJECTS iteration exceeds the maximum number of pages (`max_iter`), dbt warns with the total object cap (`max_results_per_iter * max_iter`) and breaks out of the loop, so the cached relation list for the schema is incomplete. dbt configurable pagination via `list_relations_per_page` and `list_relations_page_limit` project flags.

Source

Thrown at crates/dbt-loader/src/dbt_macro_assets/dbt-snowflake/macros/metadata/list_relations_without_caching.sql:31

        {{ schema }} exceeds this limit. If this is expected, you may configure this limit
        by setting list_relations_per_page and list_relations_page_limit in your project flags.
        It is recommended to start by increasing list_relations_page_limit.
    {%- endset -%}

    {%- set paginated_state = namespace(paginated_results=[], watermark=none) -%}

    {#-
        loop an extra time to catch the breach of max iterations
        Note: while range is 0-based, loop.index starts at 1
    -#}
    {%- for _ in range(max_iter + 1) -%}

        {#-
            raise a warning and break if we still didn't exit and we're beyond the max iterations limit
            Note: while range is 0-based, loop.index starts at 1
        -#}
        {%- if loop.index == max_iter + 1 -%}
            {%- do exceptions.warn(too_many_relations_msg) -%}
            {%- break -%}
        {%- endif -%}

        {%- set show_objects_sql = snowflake__show_objects_sql(schema, max_results_per_iter, paginated_state.watermark) -%}
        {%- set paginated_result = run_query(show_objects_sql) -%}
        {%- do paginated_state.paginated_results.append(paginated_result) -%}
        {%- set paginated_state.watermark = paginated_result.columns.get('name').values()[-1] -%}

        {#- we got less results than the max_results_per_iter (includes 0), meaning we reached the end -#}
        {%- if (paginated_result | length) < max_results_per_iter -%}
            {%- break -%}
        {%- endif -%}

    {%- endfor -%}

    {#- grab the first table in the paginated results to access the `merge` method -#}
    {%- set agate_table = paginated_state.paginated_results[0] -%}
    {%- do return(agate_table.merge(paginated_state.paginated_results)) -%}

View on GitHub (pinned to 0267ce9170)

Solutions

  1. Increase `list_relations_page_limit` in project flags (recommended first step) so more pages are iterated
  2. Increase `list_relations_per_page` to fetch more objects per SHOW OBJECTS query
  3. Move models out of the oversized schema, or clean up unused relations to get under the limit
  4. Scope dbt to a dedicated schema for the project to reduce object count

Example fix

// before (dbt_project.yml)
flags:
  list_relations_per_page: 10000
// after
flags:
  list_relations_per_page: 10000
  list_relations_page_limit: 10
Defensive patterns

Strategy: validation

Validate before calling

// before running dbt, estimate schema object count against the pagination cap
const cap = flags.list_relations_per_page * flags.list_relations_page_limit;
const objectCount = await countObjectsInSchema(schema);
if (objectCount >= cap) {
  console.warn(`Schema has ${objectCount} objects >= cap ${cap}; raise list_relations_page_limit.`);
}

Prevention

When it happens

Trigger: Running `dbt run`/`dbt docs` against a Snowflake schema containing more objects than `list_relations_per_page * list_relations_page_limit` (default cap), so SHOW OBJECTS pagination never terminates before the iteration limit.

Common situations: Very large shared/analytics schemas with thousands of tables/views; default page limits hit during cache population; runs against schemas polluted by other tools.

Understand the failure class

Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.

Related errors


AI-assisted analysis of dbt-labs/dbt-core@0267ce9170 (2026-09-07). Data as JSON: /api/errors/031d0d7bed4edadf. Report an issue: GitHub.