`json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)` calling `resp.json()`.
BeginnerTroubleshootingRuntime, file, subprocess & encoding errors
Answer
Likely causes → The response body is empty or not JSON: an HTML error page from a proxy or load balancer, a 204 No Content, a redirect to a login page, or an auth failure.
Diagnose →
print(resp.status_code, resp.headers.get("Content-Type"), resp.text[:500])
Fix → Call resp.raise_for_status() before .json(), check Content-Type, handle 204 explicitly, and fix the underlying auth or URL.
Prevent → A client wrapper that logs status and the first bytes of the body on parse failure.
More on Runtime, file, subprocess & encoding errors
`KeyError: 'Tags'` while processing `describe_instances` output.Beginner`TypeError: can't compare offset-naive and offset-aware datetimes` in a snapshot-age check.Beginner`UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte` reading a log file.Intermediate`UnicodeEncodeError: 'ascii' codec can't encode character '✓'` when printing in a container.Intermediate`PermissionError: [Errno 13] Permission denied: '/var/log/app/report.json'`Intermediate`OSError: [Errno 24] Too many open files` in a long-running Python service.Intermediate