External Publication
Visit Post

Help please.. HyperErrorLegacy

Hugging Face Forums [Unofficial] June 4, 2026
Source

Thank you! But, hmm, I tried a few things from a Colab Free environment, but I still cannot reproduce this…


I tested the reported InferenceClient.feature_extraction(...) path from Google Colab Free.

Platform: Linux-6.6.122+-x86_64-with-glibc2.35
Python:   3.12.13

Results:

huggingface_hub Token Result
1.17.0 yes OK
1.17.0 no normal 401 Unauthorized
0.36.2 yes OK
0.36.2 no normal 401 Unauthorized

With HF_DEBUG=1, the default call:

from huggingface_hub import InferenceClient

client = InferenceClient()
client.feature_extraction("Hi, who are you?")

resolved to the expected router path:

GET  https://huggingface.co/api/tasks
GET  https://huggingface.co/api/models/facebook/bart-base
POST https://router.huggingface.co/hf-inference/models/facebook/bart-base/pipeline/feature-extraction

With a token, this worked and returned an ndarray of shape:

(8, 768)

Without a token, the same router URL returned a normal:

401 Unauthorized

So I cannot reproduce:

HyperErrorLegacy(hyper_util::client::legacy::Error(
    Connect,
    ConnectError("invalid URL, scheme is not http")
))

from Colab.

I also tested explicit models:

Model Provider Result
sentence-transformers/all-MiniLM-L6-v2 hf-inference OK, shape (384,)
ibm-granite/granite-embedding-97m-multilingual-r2 hf-inference OK, shape (384,)
thenlper/gte-large hf-inference local ValueError; task metadata says sentence-similarity, not feature-extraction

The thenlper/gte-large result seems unrelated to HyperErrorLegacy; it fails before the router POST.

Relevant docs:

  • InferenceClient reference
  • Feature Extraction task docs
  • HF Inference provider docs
  • HF_DEBUG, HF_INFERENCE_ENDPOINT, and other huggingface_hub env vars
  • huggingface_hub v1 migration notes: requests → httpx

My current guess is that this was either transient, environment-specific, proxy/gateway-specific, region/backend-shard-specific, or related to an endpoint override such as HF_INFERENCE_ENDPOINT / HF_ENDPOINT.

Could the reporter share:

import os
import sys
import huggingface_hub

try:
    import requests
except Exception:
    requests = None

try:
    import httpx
except Exception:
    httpx = None

print("python:", sys.version)
print("huggingface_hub:", huggingface_hub.__version__)
print("requests:", getattr(requests, "__version__", None))
print("httpx:", getattr(httpx, "__version__", None))
print("HF_TOKEN_present:", bool(os.environ.get("HF_TOKEN")))
print("HF_ENDPOINT:", os.environ.get("HF_ENDPOINT"))
print("HF_INFERENCE_ENDPOINT:", os.environ.get("HF_INFERENCE_ENDPOINT"))
print("HF_HUB_DISABLE_IMPLICIT_TOKEN:", os.environ.get("HF_HUB_DISABLE_IMPLICIT_TOKEN"))
print("HTTP_PROXY:", bool(os.environ.get("HTTP_PROXY")))
print("HTTPS_PROXY:", bool(os.environ.get("HTTPS_PROXY")))
print("ALL_PROXY:", bool(os.environ.get("ALL_PROXY")))

and, if possible, rerun with:

HF_DEBUG=1 python repro.py

Please redact any token before posting. The most useful detail would be the HF_DEBUG=1 output showing the exact URL being called.

Discussion in the ATmosphere

Loading comments...