Skip to content

[bug]: Context Chat Backend returns 404 via HaRP leading to "response body is not a valid JSON" error #271

@oliveiraigorm

Description

@oliveiraigorm

After successfully installing and enabling the Context Chat Backend, running occ context_chat:scan <your_user_id> fails with Error during request to Context Chat Backend (ExApp): response body is not a valid JSON.

Initially, the backend was crashing because the embedding model multilingual-e5-large-instruct-q6_k.gguf was missing from the persistent volume. After manually downloading this model, the backend starts correctly and the embedding server is active.

However, Nextcloud still cannot communicate with the backend. Debugging LangRopeService.php revealed that Nextcloud receives a 404 Not Found response from the HaRP proxy when querying http://<harp_container>:8780/exapps/context_chat_backend/enabled, despite the backend reporting a successful FRP tunnel connection to HaRP.

Server logs

Details ``` In LangRopeService.php line 87:

Error during request to Context Chat Backend (ExApp): response body is not
a valid JSON

DEBUG LOG from modified LangRopeService.php:
DEBUG RAW RESPONSE: [] STATUS: 404

</details>

**Context Chat Backend logs**
<details>

[I] [client/service.go:287] [80e9fcd3d711a7b2] login to server success, get run id [80e9fcd3d711a7b2]
[I] [proxy/proxy_manager.go:173] [80e9fcd3d711a7b2] proxy added: [context_chat_backend]
[I] [client/control.go:168] [80e9fcd3d711a7b2] [context_chat_backend] start proxy success

App config:
{
"embedding": {
"llama": {
"model": "multilingual-e5-large-instruct-q6_k.gguf",
"n_batch": 16,
"n_ctx": 8192
}
}
}
INFO: Application startup complete.
INFO: Uvicorn running on unix socket /tmp/exapp.sock (Press CTRL+C to quit)
INFO: Uvicorn running on http://localhost:5000 (Press CTRL+C to quit)

</details>

**Setup Details (please complete the following information):**
 - Nextcloud Version: 32.0.5
 - AppAPI Version: 32.0.0
 - Context Chat PHP Version: 5.2.1
 - Context Chat Backend Version: 5.2.0
 - Nextcloud deployment method: Docker
 - Context Chat Backend deployment method: Manual registration via AppAPI HaRP daemon

**Additional Context**
- The backend unix socket `/tmp/exapp.sock` exists and is responsive to internal signatures (returns "Invalid signature" when curled without NC headers, which is expected).
- The HaRP proxy seems to fail to route the request to the FRP tunnel even though the tunnel is "success".
- Manually fixing the missing model file resolved internal backend crashes, but the 404 routing issue persists.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions