Codeinwp / Codeinwp/hyve-lite

Knowledge Base add fails silently with an empty 200 when allow_url_fopen=0

Open
#241 1 comment 0 reactions 1 assignee View on GitHub

@HardeepAsrani is already working on this.

Since Aug 31, 2026.

Dominant language
PHP
Stars
1
Forks
1
Avg merge
6h 8m
Merged PRs (30d)
5

Description

Environment: Hyve Lite 2.0.1 - WordPress 7.1 - PHP 8.4.24 - LiteSpeed - shared cPanel host with allow_url_fopen=0

What happens

Clicking Add on any post in Knowledge Base -> WordPress does nothing. POST /wp-json/hyve/v1/data returns HTTP 200 with Content-Length: 0 in ~200 ms. The admin JS gets an unparseable empty body and surfaces a generic error with no indication of the cause. Nothing in the UI explains it, and the plugin otherwise looks healthy: the header shows "API connected" and the chat works, returning real OpenAI responses.

Root cause

Tokenizer::tokenize() builds an EncoderProvider whose DefaultVocabLoader fetches the BPE vocabulary with a raw fopen() on https://openaipublic.blob.core.windows.net/encodings/cl100k_base.tiktoken.

With allow_url_fopen=0 that returns false and the loader throws RuntimeException: Could not open stream for URI (DefaultVocabLoader.php:65-68). The call at DB_Table.php:691 is not wrapped, so the exception is uncaught and the request dies before add_data() can return anything.

From the server PHP error log:

PHP Warning:  fopen(): https:// wrapper is disabled in the server configuration by allow_url_fopen=0 in .../plugins/hyve-lite/vendor/guttedgarden/tiktoken/src/Vocab/Loader/DefaultVocabLoader.php on line 65
PHP Warning:  fopen(https://openaipublic.blob.core.windows.net/encodings/cl100k_base.tiktoken): Failed to open stream: no suitable wrapper could be found in .../DefaultVocabLoader.php on line 65

Three separate problems

  1. Hard dependency on allow_url_fopen. Every other outbound call in the plugin goes through the WP HTTP API, so a host that permits cURL but disables URL-fopen breaks only this path, which is why the chat works while ingestion does not. The vocab fetch should use wp_remote_get() and write the cache file itself, or the ~1.7 MB cl100k_base.tiktoken should ship with the plugin.
  2. No error handling around the tokenizer. Tokenizer::tokenize() should be wrapped so a vocab failure becomes a WP_Error that add_data() can surface, instead of a fatal that produces an empty 200 the frontend cannot interpret.
  3. Leaked processing flag. add_post() sets _hyve_post_processing before ingesting and deletes it after. When the request dies in between, the flag survives and the post shows "Hyve is processing the post" in the Posts row actions for PROCESSING_STALL (300 s), which misleads the user into thinking something is still running.

Steps to reproduce

  1. On a host with allow_url_fopen=0, install Hyve Lite and connect an OpenAI API key.
  2. Knowledge Base -> WordPress -> click Add on any post.
  3. Network tab: POST /wp-json/hyve/v1/data returns 200 with a zero-length body. The PHP error log shows the two fopen() warnings above.

Suggested fix

Replace the fopen-based vocab fetch with wp_remote_get() plus a local write, and wrap the tokenizer call so failures reach the user as a readable message rather than an empty response.

Contributor guide

No contributing guide indexed for this repository

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.