Coding & Software
Write Unit Tests for a Function
Generates focused unit tests for one function, covering normal cases, boundaries and invalid input without mocking more than needed.
- Customizable fields
- 3 fields
Coding & Software
Paste an error and the code around it to get ranked causes, the smallest fix and a quick check to confirm the diagnosis.
Designed for general-purpose AI assistantsPublished November 2026
Fill in the fields and the prompt updates. What you type stays in this page and is never saved or sent.
Help me debug an error. Work from the evidence I give you and do not guess past it.
Language or tool: {{language or tool}}
What I was trying to do: {{goal}}
Error message or stack trace:
{{error message}}
Relevant code or configuration:
{{code}}
What I have already tried: nothing yet
Answer in this structure:
1. What the error means, in plain language.
2. The three most likely causes, ranked, each with the evidence in my message that points to it.
3. For the top cause, the smallest change that would fix it, shown as code.
4. A quick check I can run to confirm the diagnosis before I change anything.
5. What other information would help if none of these causes fit.4 required fields are empty and will stay as a {{placeholder}} in the copied text.
Illustrative only. Real answers depend on your input and the assistant you use.
1. What it means: Python could not find a key named "user_id" in the dictionary the function received, so it raised KeyError at the line that reads it.
2. Likely causes:
- The caller passes the dictionary before the "user_id" field is added (the traceback shows the call happens inside load_session, before enrich_user runs).
- The upstream API returns the field as "userId" for some accounts.
- The dictionary is empty because the earlier request failed silently.
3. Smallest fix for the top cause: call enrich_user(session) before build_report(session), or read the value with session.get("user_id") and handle None explicitly.
4. Check: print(session.keys()) just before the failing line. If "user_id" is missing there, the order of the calls is the problem.
5. If this does not fit, send me the output of that print and the body of enrich_user.Coding & Software
Generates focused unit tests for one function, covering normal cases, boundaries and invalid input without mocking more than needed.
Coding & Software
Finds why a test passes sometimes and fails other times, ranks the likely causes and gives an experiment to prove each one.
Coding & Software
Writes reference documentation for one API endpoint from its code, covering parameters, responses, errors and a working example.