nextcloud / nextcloud/context_chat

A temporary indexing error leaves a document stuck for 24 hours, with no way to retry

Open
#264 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug priority: medium
Dominant language
PHP
Stars
29
Forks
12
Avg merge
4d 4h
Merged PRs (30d)
5

Description

Which version of Nextcloud are you using?

34.0.2

Which version of PHP context_chat are you using?

5.4.0

Which version of backend context_chat are you using?

5.4.1

Which browser are you using? In case you are using the phone App, specify the Android or iOS version and device please.

Chrome 151.0.7922.76

Nextcloud deployment method?

Docker Compose on Coolify

Describe the Bug

I created a Markdown document in Nextcloud, added some text, and then asked Nextcloud Assistant a question about it.

The Assistant failed with:

No documents retrieved, please choose a wider scope of documents to search from

The Context Chat admin page then showed:

Locked documents in queue: 1

There was no indication of which document was affected or why it was locked.

After checking the database and logs, the locked item turned out to be the document I had just created. Context Chat tried to index it while it was still being saved. Fetching the file temporarily returned HTTP 400 (I do not know why), but the file became available normally about 20 seconds later.

The backend correctly described this error as retryable. However, the document remained locked in the indexing queue. Saving the document again did not trigger another attempt.

Apparently, that queue lock lasts for 24 hours. There is also no retry button, unlock button, or occ command for administrators.

This is particularly confusing because the document itself is not locked. It can still be opened and edited. Only its Context Chat indexing job is stuck.

To Reproduce
  1. Create a new Markdown or text document in Nextcloud.
  2. Add some content using the web editor, save, close the editor.
  3. Shortly afterwards, select that document in Nextcloud Assistant (e.g. via context chat search with explicitly that document selected)
  4. Ask a question about its contents.
  5. If Context Chat attempts to index the file, the Assistant reports that no documents were found.
  6. Open the Context Chat admin page.
  7. It shows one locked document, but does not say which document it is or how to retry it.

I think a temporary error while reading a file should be retried automatically after a short delay.

At the very least, the admin page should show:

  • which document is stuck;
  • why indexing failed;
  • when it will be retried;
  • a button to retry or cancel the indexing job.

Saving or modifying the document again should also make it eligible for indexing.

Actual behaviour

The indexing attempt failed - not sure why, I regularly created a doc and saved it and closed the editor.

A few seconds later, the document was readable and its permissions were fine. However, its indexing job remained locked and would not be retried for 24 hours.

The Assistant continued to fail when the document was selected as its source.

PHP logs (Warning these might contain sensitive information)

Error fetching content for file:
[400] Bad Request

IndexingException: Network error encountered fetching content

0 succeeded, 1 errored
retryable=True

Some sources failed to index

Ex-App logs (Warning these might contain sensitive information)

No response

Server logs (if applicable)

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the indexing queue and the Context Chat admin page, then trace how the logged retryable=True error is handled when a document becomes locked. Done should include a defined retry or unlock path for temporary failures, visibility into the affected document and failure timing, and re-eligibility after saving or modifying the document.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend, search
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.