Prompt
How do I troubleshoot an endpoint that returns 200 but is still broken?
Latest observation
A 200 OK only means the server successfully returned a response — not that the response is correct, complete, or useful. To troubleshoot an endpoint that “works” at the HTTP level but is still broken, check it in layers:
1) Verify the response body, not just the status
- Inspect the actual payload.
- Confirm it contains the expected data, fields, and values.
- Watch for:
- empty arrays/objects when data should exist
- error messages embedded in a
200response - partial results
- HTML returned instead of JSON
2) Check response headers
Look for clues in:
Content-Type— is it what you expect?Cache-Control— could you be seeing stale data?Content-Encoding— is compression causing client issues?X-Request-Id/ trace headers — useful for backend logs
3) Compare with a known-good request
- Reproduce the request with
curl, Postman, or a browser dev tool. - Compare:
- URL
- query params
- headers
- auth tokens
- request body
- Small differences often explain “200 but broken.”
4) Inspect server-side logs and traces
A successful HTTP response may still hide internal problems:
- exceptions swallowed by the app
- fallback/default behavior
- downstream service failures
- database query returning no rows
- timeouts handled by returning a default response
If you have tracing:
- find the request by request ID
- inspect each dependency call
- look for retries, errors, or slow spans
5) Validate downstream dependencies
The endpoint may be healthy but dependent services may not be:
- database
- cache
- message queue
- third-party API
- auth service
Check:
- connection errors
- timeouts
- stale or missing data
- degraded fallback logic
6) Check client-side behavior
Sometimes the endpoint is fine, but the client breaks:
- JSON parsing errors
- schema mismatch
- incorrect assumptions about fields
- CORS issues
- frontend code ignoring the response
- caching in browser/service worker/CDN
Use browser dev tools or client logs to confirm.
7) Test with edge cases
A 200 may hide bugs only visible with certain inputs:
- empty input
- special characters
- large payloads
- invalid IDs
- unauthenticated/expired sessions
- pagination boundaries
8) Confirm deployment/version mismatch
Make sure the running service is the code you expect:
- stale deployment
- config mismatch
- feature flag disabled
- blue/green or canary routing to an older version
9) Add or inspect contract tests
If this endpoint is important:
- define the expected schema
- add tests for response shape and semantics
- validate both success and failure cases
10) If needed, treat 200 as a bug
If the endpoint reports success while the operation failed, that’s an application bug. Common fixes:
- return the correct HTTP status
- include explicit error fields
- avoid swallowing exceptions
- log and surface partial failures properly
Quick triage checklist
- Is the body correct?
- Are headers correct?
- Is the same request reproduced outside the app?
- Do logs show hidden errors?
- Are dependencies healthy?
- Is the client interpreting it correctly?
- Is the deployed version/config correct?
If you want, I can also give you a step-by-step debugging playbook for REST APIs, or a curl/Postman checklist for narrowing this down fast.