jdx/mise · error
Got non-HTML text from {}
Error message
Got non-HTML text from {} What it means
get_html fetches a URL expecting an HTML page. After reading the response it checks the Content-Type (media type before any ';' charset suffix, trimmed, case-insensitive); if it is not text/html, it refuses to parse and throws this error.
Source
Thrown at src/http.rs:722
}
}
pub(crate) async fn get_html<U: IntoUrl>(&self, url: U) -> Result<String> {
let url = url.into_url()?;
let resp = self.get_async(url.clone()).await?;
let is_html = resp
.headers()
.get(CONTENT_TYPE)
.and_then(|content_type| content_type.to_str().ok())
.is_some_and(|content_type| {
content_type
.split_once(';')
.map_or(content_type, |(media_type, _)| media_type)
.trim()
.eq_ignore_ascii_case("text/html")
});
if !is_html {
bail!("Got non-HTML text from {}", url);
}
let html = resp.text().await?;
Ok(html)
}
pub(crate) async fn json_headers<T, U: IntoUrl>(&self, url: U) -> Result<(T, HeaderMap)>
where
T: serde::de::DeserializeOwned,
{
let url = url.into_url()?;
let resp = self.get_async(url).await?;
let headers = resp.headers().clone();
let json = resp.json().await?;
Ok((json, headers))
}
pub(crate) async fn json_headers_with_headers<T, U: IntoUrl>(
&self,View on GitHub (pinned to afd2eddd3a)
Solutions
- Point the caller at the actual HTML page URL (or the JSON API endpoint and parse JSON instead)
- Check whether the host migrated its page layout/API and update the scraping logic in mise or the plugin
- Disable any custom URL override (e.g. mirror/API env var) that redirects to a non-HTML endpoint
- Update mise or the plugin so its list-URL matches the current upstream page
Example fix
// before
let html = http.get_html("https://example.com/api/versions.json")?; // JSON endpoint
// after
let html = http.get_html("https://example.com/downloads/")?; // actual HTML page Defensive patterns
Strategy: validation
Validate before calling
let resp = reqwest::get(url).await?;
let ct = resp.headers().get(reqwest::header::CONTENT_TYPE)
.and_then(|v| v.to_str().ok()).unwrap_or("");
assert!(ct.starts_with("text/html"), "expected HTML, got {ct} for {url}"); Prevention
- Verify list URLs actually serve HTML pages, not JSON APIs
- Track upstream site changes for tools you scrape
- Prefer official JSON endpoints with json_headers when the host offers one
When it happens
Trigger: Calling HttpRedis/get_html on a URL whose server responds with a non-HTML Content-Type — e.g. application/json, text/plain, application/octet-stream, or a redirect target returning JSON.
Common situations: Scraping a plugin/tool index whose endpoint changed from an HTML page to a JSON API; a URL now redirecting to an API route or an error page served as text/plain; version-list scraping for a tool whose host changed its site.
Related errors
- Got HTML instead of text from {}
- remote cache blob pack has an invalid content type
- Got HTML instead of text from {url}
- remote action manifest ETag does not match its body
- cannot encode #{value.class} as JSON
AI-assisted analysis of jdx/mise@afd2eddd3a (2026-09-09).
Data as JSON: /api/errors/a2d073dbeca4a1d9.
Report an issue: GitHub.