[BUG] Knowledge Base Document Pagination Fails - Page Always Redirects to First Page #21669

Closed
opened 2026-02-21 20:13:47 -05:00 by yindo · 2 comments
Owner

Originally created by @hakomicat on GitHub (Jan 15, 2026).

Self Checks

  • I have read the Contributing Guide and Language Policy.
  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report, otherwise it will be closed.
  • 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1.9.2

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Describe the Bug

In the knowledge base document list interface, the pagination function is abnormal. Except for the first page, clicking on any page number or the "Next Page" button causes the page to forcibly jump back to the first page. Modifying the number of items per page (limit parameter) also does not take effect.

To Reproduce

  1. Go to any knowledge base that contains multiple pages of documents.
  2. Navigate to the document management list for that knowledge base.
  3. Click on page number 2, 3, or the "Next Page" button.
  4. Actual Result: The page content still displays the first page's data. The URL address bar briefly shows the target page number but immediately reverts to page=1.
  5. Try changing the number of items displayed per page (e.g., from 20 to 50).
  6. Actual Result: The display count does not change, and the limit parameter in the URL is forcibly reset to the default value.

Bug Analysis & Context

  • API Endpoint: The problematic API endpoint is: /datasets/{dataset_id}/documents.
  • Error URL Example: http://{host}/datasets/83d4d682-fa1d-4fa8-a326-76a665fa238f/documents?page=2&limit=10&_rsc=ajnqi
  • Suspected Cause: Based on the behavior, the issue likely lies in the frontend routing handling or the state management of pagination parameters. There might be a client-side interception or resetting of the page and limit query parameters before or after the API request is made. The _rsc parameter suggests the possible use of a React server components framework, where routing state synchronization might be faulty.
  • Impact: This bug severely affects user experience, making it impossible to browse, manage, or select documents beyond the first page in any knowledge base with a large number of documents.

Screenshots, Logs

Image

Network log shows that after clicking page 2, a request is sent with ?page=2&limit=20, but it is immediately followed by a redirected request to ?page=1&limit=20.

Environment

  • Dify Version: [1.9.2]
  • Deployment Method: [Docker Compose]
  • Browser: [Chrome]

This issue was discovered during a data migration API operation and directly blocks the management of large-scale knowledge bases.

✔️ Expected Behavior

Expected Behavior

  1. Clicking on different page numbers should correctly load and display the data for that corresponding page.
  2. Modifying the number of items per page should immediately refresh the list to display the specified number of documents.

Actual Behavior

Actual Result: The display count does not change, and the limit parameter in the URL is forcibly reset to the default value.

Originally created by @hakomicat on GitHub (Jan 15, 2026). ### Self Checks - [x] I have read the [Contributing Guide](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) and [Language Policy](https://github.com/langgenius/dify/issues/1542). - [x] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [x] I confirm that I am using English to submit this report, otherwise it will be closed. - [x] 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 1.9.2 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce ### Describe the Bug In the knowledge base document list interface, the pagination function is abnormal. Except for the first page, clicking on any page number or the "Next Page" button causes the page to forcibly jump back to the first page. Modifying the number of items per page (`limit` parameter) also does not take effect. ### To Reproduce 1. Go to any knowledge base that contains multiple pages of documents. 2. Navigate to the document management list for that knowledge base. 3. Click on page number `2`, `3`, or the "Next Page" button. 4. **Actual Result:** The page content still displays the first page's data. The URL address bar briefly shows the target page number but immediately reverts to `page=1`. 5. Try changing the number of items displayed per page (e.g., from 20 to 50). 6. **Actual Result:** The display count does not change, and the `limit` parameter in the URL is forcibly reset to the default value. ### Bug Analysis & Context * **API Endpoint:** The problematic API endpoint is: `/datasets/{dataset_id}/documents`. * **Error URL Example:** `http://{host}/datasets/83d4d682-fa1d-4fa8-a326-76a665fa238f/documents?page=2&limit=10&_rsc=ajnqi` * **Suspected Cause:** Based on the behavior, the issue likely lies in the **frontend routing handling** or the **state management of pagination parameters**. There might be a client-side interception or resetting of the `page` and `limit` query parameters before or after the API request is made. The `_rsc` parameter suggests the possible use of a React server components framework, where routing state synchronization might be faulty. * **Impact:** This bug severely affects user experience, making it impossible to browse, manage, or select documents beyond the first page in any knowledge base with a large number of documents. ### Screenshots, Logs ![Image](https://github.com/user-attachments/assets/2b64912e-e99c-45de-a413-22a604c98c03) Network log shows that after clicking page 2, a request is sent with `?page=2&limit=20`, but it is immediately followed by a redirected request to `?page=1&limit=20`. ### Environment - **Dify Version:** [1.9.2] - **Deployment Method:** [Docker Compose] - **Browser:** [Chrome] *This issue was discovered during a data migration API operation and directly blocks the management of large-scale knowledge bases.* ### ✔️ Expected Behavior ### Expected Behavior 1. Clicking on different page numbers should correctly load and display the data for that corresponding page. 2. Modifying the number of items per page should immediately refresh the list to display the specified number of documents. ### ❌ Actual Behavior **Actual Result:** The display count does not change, and the `limit` parameter in the URL is forcibly reset to the default value.
yindo added the 🐞 bug label 2026-02-21 20:13:47 -05:00
yindo closed this issue 2026-02-21 20:13:47 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Jan 15, 2026):

This is a known bug in Dify v1.9.2: pagination in the knowledge base document list doesn't work—clicking page numbers or changing the items per page just flashes the UI and snaps back to the first page. The root cause is a frontend state management and router synchronization issue, not a backend/API problem. The main logic is in the frontend files handling pagination state and URL query sync, especially around the useDocumentsPageState and useDocumentListQueryState hooks (source, source).

This bug has been fixed in a later version (PR #27386). If you can, upgrade to a version that includes this fix. If you can't upgrade right now, a temporary workaround is to refresh the page after changing filters or page size—sometimes this helps the correct state persist (source). If the problem persists, try clearing your browser cache, check for JavaScript errors in the console, and make sure your Docker deployment is serving the latest frontend build (not a cached or stale asset) (source).

You can track the issue and related discussions here: #1542, #27351, #27450, #27491.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

Chat with Dosu Open in Cursor Join Discord Share on X

@dosubot[bot] commented on GitHub (Jan 15, 2026): <!-- Answer --> This is a known bug in Dify v1.9.2: pagination in the knowledge base document list doesn't work—clicking page numbers or changing the items per page just flashes the UI and snaps back to the first page. The root cause is a frontend state management and router synchronization issue, not a backend/API problem. The main logic is in the frontend files handling pagination state and URL query sync, especially around the `useDocumentsPageState` and `useDocumentListQueryState` hooks ([source](https://github.com/langgenius/dify/blob/4a197b94585a25c0f79bce4227b7ef3f89680ad0/web/app/components/datasets/documents/hooks/use-documents-page-state.ts), [source](https://github.com/langgenius/dify/blob/4a197b94585a25c0f79bce4227b7ef3f89680ad0/web/app/components/datasets/documents/hooks/use-document-list-query-state.ts)). This bug has been fixed in a later version ([PR #27386](https://github.com/langgenius/dify/issues/27351)). If you can, upgrade to a version that includes this fix. If you can't upgrade right now, a temporary workaround is to refresh the page after changing filters or page size—sometimes this helps the correct state persist ([source](https://github.com/langgenius/dify/issues/27491)). If the problem persists, try clearing your browser cache, check for JavaScript errors in the console, and make sure your Docker deployment is serving the latest frontend build (not a cached or stale asset) ([source](https://github.com/langgenius/dify/issues/27539)). You can track the issue and related discussions here: [#1542](https://github.com/langgenius/dify/issues/1542), [#27351](https://github.com/langgenius/dify/issues/27351), [#27450](https://github.com/langgenius/dify/issues/27450), [#27491](https://github.com/langgenius/dify/issues/27491). <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/9cb5c3a7-800e-41b5-9a1d-f8c2565c087f?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/9cb5c3a7-800e-41b5-9a1d-f8c2565c087f?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/9cb5c3a7-800e-41b5-9a1d-f8c2565c087f?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/9cb5c3a7-800e-41b5-9a1d-f8c2565c087f?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/9cb5c3a7-800e-41b5-9a1d-f8c2565c087f?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/9cb5c3a7-800e-41b5-9a1d-f8c2565c087f?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/9cb5c3a7-800e-41b5-9a1d-f8c2565c087f?feedback_type=other)</sup> [![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/6088a4f4-073a-43f3-b3d4-4f06fb0c05a0/ask?utm_source=github)&nbsp;[![Open in Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=This%20is%20a%20known%20bug%20in%20Dify%20v1.9.2%3A%20pagination%20in%20the%20knowledge%20base%20document%20list%20doesn%27t%20work%E2%80%94clicking%20page%20numbers%20or%20changing%20the%20items%20per%20page%20just%20flashes%20the%20UI%20and%20snaps%20back%20to%20the%20first%20page.%20The%20root%20cause%20is%20a%20frontend%20state%20management%20and%20router%20synchronization%20issue%2C%20not%20a%20backend/API%20problem.%20The%20main%20logic%20is%20in%20the%20frontend%20files%20handling%20pagination%20state%20and%20URL%20query%20sync%2C%20especially%20around%20the%20%60useDocumentsPageState%60%20and%20%60useDocumentListQueryState%60%20hooks%20%28%5Bsource%5D%28https%3A//github.com/langgenius/dify/blob/4a197b94585a25c0f79bce4227b7ef3f89680ad0/web/app/components/datasets/documents/hooks/use-documents-page-state.ts%29%2C%20%5Bsource%5D%28https%3A//github.com/langgenius/dify/blob/4a197b94585a25c0f79bce4227b7ef3f89680ad0/web/app/components/datasets/documents/hooks/use-document-list-query-state.ts%29%29.%0A%0AThis%20bug%20has%20been%20fixed%20in%20a%20later%20version%20%28%5BPR%20%2327386%5D%28https%3A//github.com/langgenius/dify/issues/27351%29%29.%20If%20you%20can%2C%20upgrade%20to%20a%20version%20that%20includes%20this%20fix.%20If%20you%20can%27t%20upgrade%20right%20now%2C%20a%20temporary%20workaround%20is%20to%20refresh%20the%20page%20after%20changing%20filters%20or%20page%20size%E2%80%94sometimes%20this%20helps%20the%20correct%20state%20persist%20%28%5Bsource%5D%28https%3A//github.com/langgenius/dify/issues/27491%29%29.%20If%20the%20problem%20persists%2C%20try%20clearing%20your%20browser%20cache%2C%20check%20for%20JavaScript%20errors%20in%20the%20console%2C%20and%20make%20sure%20your%20Docker%20deployment%20is%20serving%20the%20latest%20frontend%20build%20%28not%20a%20cached%20or%20stale%20asset%29%20%28%5Bsource%5D%28https%3A//github.com/langgenius/dify/issues/27539%29%29.%0A%0AYou%20can%20track%20the%20issue%20and%20related%20discussions%20here%3A%20%5B%231542%5D%28https%3A//github.com/langgenius/dify/issues/1542%29%2C%20%5B%2327351%5D%28https%3A//github.com/langgenius/dify/issues/27351%29%2C%20%5B%2327450%5D%28https%3A//github.com/langgenius/dify/issues/27450%29%2C%20%5B%2327491%5D%28https%3A//github.com/langgenius/dify/issues/27491%29.)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify/issues/31048)
Author
Owner

@fatelei commented on GitHub (Jan 15, 2026):

update to the latest version

@fatelei commented on GitHub (Jan 15, 2026): update to the latest version
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#21669