{"slug": "gradio-web-components-failing-to-load", "title": "Gradio web components failing to load", "summary": "Gradio web components are failing to load on Hugging Face Spaces due to a host resolution issue, generating malformed URLs like 'https://.hf.space/config' instead of valid Space subdomains. The problem appears to be a browser-facing integration path failure rather than a user app runtime bug, potentially linked to broader Spaces proxy or CORS inconsistencies.", "body_md": "Thanks. I see. If it happens with that method too, this may connect to [something beyond just Gradio itself](https://discuss.huggingface.co/t/hugging-face-spaces-proxy-suddenly-stripping-access-control-allow-credentials-header-on-options-preflight/177064):\n\nThe `https://.hf.space/config`\n\npart changes the picture quite a bit.\n\nMy previous guess was narrower:\n\n```\nsrc=\"https://<space-subdomain>.hf.space\"\n  → possibly failing through the by-subdomain lookup path\n```\n\nBut if this also happens with:\n\n```\n<gradio-app space=\"<owner>/<space_name>\"></gradio-app>\n```\n\nand the component repeatedly tries to fetch:\n\n```\nhttps://.hf.space/config\n```\n\nthen this looks broader than only a `by-subdomain`\n\nreverse-lookup problem.\n\nA literal empty-host URL like this:\n\n```\nhttps://.hf.space/config\n```\n\nsuggests that the web component, or the Hugging Face Space metadata/config resolution path behind it, failed to resolve a valid `.hf.space`\n\nhost at all.\n\nSo I would update the working hypothesis to something like this:\n\n```\nsrc=\"https://<space-subdomain>.hf.space\"\n  → may fail through by-subdomain lookup\n\nspace=\"<owner>/<space_name>\"\n  → may fail through owner/name → resolved Space host/config lookup\n\ncommon layer:\n  browser-facing Space identity/config resolution path\n```\n\nThat is hard to explain as a bug inside the user Space runtime itself.\n\nIf the generated URL is literally:\n\n```\nhttps://.hf.space/config\n```\n\nthen the missing value is probably the resolved Space subdomain / host, not something inside the Gradio app running in the Space.\n\n##\nWhy this seems broader than the original repo-name hypothesis\n\nThe earlier repo-name hypothesis still seems useful for the `by-subdomain`\n\nerror, especially because of the similar Gradio issue here:\n\nIn that issue, this request:\n\n```\nGET https://huggingface.co/api/spaces/by-subdomain/jglowa-ai-gov-pl\n```\n\nreturns:\n\n```\n{\"error\":\"Invalid repo name: jglowa/ai-gov.pl - repo name includes an url-encoded slash\"}\n```\n\nThat still looks like a suspicious subdomain → repo-id lookup / validation problem.\n\nBut your new result adds another layer:\n\n```\nspace=\"<owner>/<space_name>\"\n  → https://.hf.space/config\n```\n\nThat means the explicit `space=`\n\nform does not fully avoid the failing path in your case. Instead, it seems to reach a different failure mode: the component cannot build a valid config URL.\n\nSo I would now separate the possible issues like this:\n\n| Layer |\nExample symptom |\n| Repo/subdomain lookup issue |\n`/api/spaces/by-subdomain/<space-subdomain>` returns `Invalid repo name ... url-encoded slash` |\n| Space host/config resolution issue |\nweb component generates `https://.hf.space/config` |\n| Browser/proxy/CORS issue |\nconfig/preflight/browser request fails before useful app logic runs |\n| User app runtime issue |\ndirect `.hf.space` app itself fails |\n\nYour report seems to point more toward the middle two layers than the last one.\n\n##\nWhy this may connect to the Spaces proxy / CORS thread\n\nThis may be related to the other recent Spaces proxy/CORS report, although I would not claim the same root cause:\n\nThe common pattern would not be:\n\n```\nthe user app crashed\n```\n\nIt would be closer to:\n\n```\nthe direct app/runtime may be healthy,\nbut a browser-facing Spaces integration path is inconsistent\n```\n\nExamples of those browser-facing paths:\n\n```\nweb component config fetch\nSpace host resolution\nby-subdomain lookup\nCORS preflight\nSpaces proxy / edge handling\nactive service binding\nmetadata / route consistency\n```\n\nThe CORS thread is about a different surface area, but it has a similar diagnostic shape: the problem may be outside the user container if the browser-facing request is answered, rewritten, stripped, cached, or misrouted before it reaches the app.\n\nHere, `https://.hf.space/config`\n\nis similarly suspicious because it looks like the component or metadata layer lost the host before the app could even matter.\n\n##\nChecks that may narrow it down\n\nI would try to separate these paths:\n\n```\ncurl -i https://<space-subdomain>.hf.space/config\ncurl -i https://huggingface.co/api/spaces/by-subdomain/<space-subdomain>\ncurl -i https://huggingface.co/api/spaces/<owner>/<space_name>\n```\n\nAnd compare the browser behavior of:\n\n```\n<iframe src=\"https://<space-subdomain>.hf.space\"></iframe>\n\n<gradio-app src=\"https://<space-subdomain>.hf.space\"></gradio-app>\n\n<gradio-app space=\"<owner>/<space_name>\"></gradio-app>\n```\n\nThe most useful matrix would be:\n\n| Test |\nResult |\nDirect `https://<space-subdomain>.hf.space` |\nworks / fails |\nDirect `https://<space-subdomain>.hf.space/config` |\nworks / fails |\n| iframe embed |\nworks / fails |\n`<gradio-app src=\"https://<space-subdomain>.hf.space\">` |\nworks / fails |\n`<gradio-app space=\"<owner>/<space_name>\">` |\nworks / fails |\n`/api/spaces/by-subdomain/<space-subdomain>` |\nworks / fails |\n`/api/spaces/<owner>/<space_name>` |\nworks / fails |\n| Gradio docs site embed |\nworks / fails |\n| Gradio web component JS version |\n`5.49.1` / other |\n\nIf direct Space access works but both web component forms fail, then I would stop focusing on the Space app code and treat this as a Gradio web component / HF Space identity-resolution / config-fetch / proxy issue.\n\nShort version: your `space=\"<owner>/<space_name>\"`\n\nresult makes this look less like only a repo-name-specific `by-subdomain`\n\nissue and more like a broader browser-facing Spaces integration problem.\n\nEspecially if the web component literally requests:\n\n```\nhttps://.hf.space/config\n```\n\nthen something upstream failed to resolve the Space host before the request even reached the user app.", "url": "https://wpnews.pro/news/gradio-web-components-failing-to-load", "canonical_source": "https://discuss.huggingface.co/t/gradio-web-components-failing-to-load/177067#post_7", "published_at": "2026-06-23 07:39:54+00:00", "updated_at": "2026-06-24 00:42:23.289547+00:00", "lang": "en", "topics": ["ai-tools", "developer-tools"], "entities": ["Gradio", "Hugging Face", "Hugging Face Spaces"], "alternates": {"html": "https://wpnews.pro/news/gradio-web-components-failing-to-load", "markdown": "https://wpnews.pro/news/gradio-web-components-failing-to-load.md", "text": "https://wpnews.pro/news/gradio-web-components-failing-to-load.txt", "jsonld": "https://wpnews.pro/news/gradio-web-components-failing-to-load.jsonld"}}