getredash/redash · error · QueryParseError

Unknown 'pagination.type' {}

Error message

Unknown 'pagination.type' {}

What it means

Thrown by JSON data source pagination configuration parser when the 'pagination.type' field is neither 'url' nor 'token'. The JSON query runner only supports these two pagination strategies, and any other value aborts query parsing before any HTTP request is made.

Source

Thrown at redash/query_runner/json_ds.py:244

    def next(self, url, request_options, response):
        """Checks the response for another page.

        Returns:
            has_more, next_url, next_request_options
        """
        return False, None, request_options

    @staticmethod
    def from_config(configuration, pagination):
        if not isinstance(pagination, dict) or not isinstance(pagination.get("type"), str):
            raise QueryParseError("'pagination' should be an object with a `type` property")

        if pagination["type"] == "url":
            return UrlPagination(pagination)
        elif pagination["type"] == "token":
            return TokenPagination(pagination)

        raise QueryParseError("Unknown 'pagination.type' {}".format(pagination["type"]))


class UrlPagination(RequestPagination):
    def __init__(self, pagination):
        self.path = pagination.get("path", "_links.next.href")
        if not isinstance(self.path, str):
            raise QueryParseError("'pagination.path' should be a string")

    def next(self, url, request_options, response):
        next_url = _apply_path_search(response, self.path, "")
        if not next_url:
            return False, None, request_options

        next_url = urljoin(url, next_url)
        return True, next_url, request_options


class TokenPagination(RequestPagination):

View on GitHub (pinned to ca79fe988d)

Solutions

  1. Set pagination.type to "url" (next-page URL extracted from response) or "token" (next-page token put in request params)
  2. Remove the pagination block entirely if the endpoint returns everything in one response
  3. Check spelling/casing of the type value

Example fix

// before
{"pagination": {"type": "offset"}}
// after
{"pagination": {"type": "url", "path": "_links.next.href"}}
Defensive patterns

Strategy: validation

Validate before calling

# before running the query
p = json.loads(query_text).get('pagination', {})
if p and p.get('type') not in ('url', 'token'):
    raise ValueError("pagination.type must be 'url' or 'token'")

Type guard

def valid_pagination(cfg: dict) -> bool:
    p = cfg.get('pagination')
    return p is None or (isinstance(p, dict) and p.get('type') in ('url', 'token'))

Prevention

When it happens

Trigger: Setting pagination.type to anything other than "url" or "token" in the JSON query's pagination block, e.g. {"pagination": {"type": "offset", "field": "page"}}.

Common situations: Developer invents a pagination style the runner doesn't support (page numbers, offsets), copies a pagination config from a different tool, or misspells 'url'/'token' (e.g. 'Url', 'tokens').

Related errors


AI-assisted analysis of getredash/redash@ca79fe988d (2026-08-28). Data as JSON: /api/errors/aa455d621929c361. Report an issue: GitHub.