is an invalid start of a value 🟪 .NET

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

  1. Check response.IsSuccessStatusCode before reading
  2. Log the raw content
  3. Fix the URL/authentication

Detailed fix by platform

C#

  1. 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

  1. Status — HTTP code
  2. Body — First characters
  3. 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:

🧠 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.