System.Text.Json: '<' is an invalid start of a value. Path: $ | LineNumber: 0 | BytePositionInLine: 0
The response wasn’t JSON — usually an HTML error page, login redirect, or an empty body was passed to the JSON deserializer.
Seen on:
.NET
Meaning
'<' means HTML (error page, proxy page, login form). Check the status code and Content-Type before deserializing, and log the raw body.
Common causes
- Server returned an HTML error/login page
- Wrong URL (frontend page instead of API)
- Empty body with 204/500
- Proxy/WAF page
⚡ Quick fix
- Check response.IsSuccessStatusCode before reading
- Log the raw content
- Fix the URL/authentication
Detailed fix by platform
C#
- csharp
var res = await http.GetAsync(url); var body = await res.Content.ReadAsStringAsync(); if (!res.IsSuccessStatusCode) throw new HttpRequestException($"{(int)res.StatusCode}: {body[..Math.Min(body.Length, 300)]}");
How to diagnose
- Status — HTTP code
- Body — First characters
- URL — API or web page?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
Most viewed in .NET
- NullReferenceException System.NullReferenceException: Object reference not set to an instance of an object
- FileNotFoundException assembly Could not load file or assembly 'X, Version=…' or one of its dependencies
- InvalidOperationException InvalidOperationException: Unable to resolve service for type 'X' while attempting to activate 'Y'
Other ways to find it
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 7 Oct 2026