[Bug]: JSON body null returns 500 on /api/clipboard/copy and /api/clipboard/paste
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- typescript, vite
Research direction
Start at the parseJsonBody helper, which currently returns whatever JSON.parse yields, then check the /api/clipboard/copy and /api/clipboard/paste handlers that read body.sessionId. The /api/rtc/answer, /api/rtc/ice and /api/config handlers show the other error paths. Done when a null body returns 400 with "Request body must be a JSON object" on every caller, with a test covering it.
Written by the indexing model from the issue text.
Description
Bug Description
parseJsonBody resolves whatever JSON.parse returns, so a request body of null resolves to null. The clipboard handlers then read body.sessionId, which throws a TypeError and is returned as a 500. Other invalid bodies ([], {}, malformed JSON) correctly return 400.
/api/clipboard/paste behaves the same. /api/rtc/answer and /api/rtc/ice return 400 because their catch handles it, but both log the same TypeError at error level. /api/config also returns 400, but the response carries a raw TypeError: Cannot destructure property 'framerate'... message.
Proposed fix: reject non-object JSON in parseJsonBody so every caller gets a 400. I would like to send the PR with tests.
Steps to Reproduce
- Start the dev server:
node node_modules/vite/bin/vite.js dev --host 127.0.0.1 --port 3000 - Send a request with the JSON body
null:
curl.exe -i -X POST -H "Content-Type: application/json" -d null http://127.0.0.1:3000/api/clipboard/copy
- The response is:
HTTP/1.1 500 Internal Server Error
{"ok":false,"error":"Failed to copy clipboard"}
- Repeat with
/api/clipboard/pasteand get the same result.
Expected Behavior
HTTP 400 with a clear "Request body must be a JSON object" error, and no TypeError in the server log.
Desktop Operating System
Windows 11
Client OS and browser
Microsoft Windows 11 Home Single Language (build 10.0.26300, 64-bit), curl.exe (curl 8.22.0), no browser, same machine as the server
Rein Version
1.0.0
Console Logs / Error Messages (Optional)
error: Error in /api/clipboard/copy: TypeError: Cannot read properties of null (reading 'sessionId') {"service":"rein-server","timestamp":"2026-11-24 21:31:06"}
error: Error in /api/clipboard/paste: TypeError: Cannot read properties of null (reading 'sessionId') {"service":"rein-server","timestamp":"2026-11-24 21:31:07"}
Screenshots / Recordings (Optional)
No response
Checklist
- I have searched for existing issues to avoid duplicates
- Dominant language
- TypeScript
- Stars
- 55
- Forks
- 120
- Avg merge
- 4d 5h
- Merged PRs (30d)
- 24
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from AOSSIE-Org/Rein
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
AOSSIE-Org/Rein#509 · 3 comments ·
Maintainers usually reply within 2 days
-
[Bug]: Session tokens expire 10 days after creation regardless of use (touchToken is never called)Possibly taken @Ankitavasudev claimed this 12 days ago. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
AOSSIE-Org/Rein#466 · 6 comments · 1 assignee ·
Maintainers usually reply within 2 days
-
[Bug]: Uploaded files are saved with garbled non-ASCII names and overwrite existing files with the same namePossibly taken @Aryan-en claimed this 23 days ago. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
AOSSIE-Org/Rein#458 · 5 comments ·
Maintainers usually reply within 2 days
-
[Bug]: Missing WebRTC playoutDelayHint introduces 50-100ms artificial latency and redundant MediaStream recreation triggers video pipeline reloadPossibly taken @MPoojaSiyag claimed this 1 day ago. Openbug enhancement
Difficulty 3/5 1-2 days Newbie friendliness 35/100
AOSSIE-Org/Rein#523 · 1 comment ·
Maintainers usually reply within 2 days
-
[Bug]: release held keys, mouse buttons, and gamepad buttons on session disconnectPossibly taken @Abfa41 claimed this 4 days ago. Openbug enhancement
Difficulty 3/5 Half a day Newbie friendliness 55/100
AOSSIE-Org/Rein#518 · 1 comment ·
Maintainers usually reply within 2 days
Similar issues
-
enhancement status:needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
dongdongbh/Mindwtr#1625 ·
Maintainers usually reply within 1 day
-
area/ui-schema good first issue type/bug
Difficulty 1/5 Under an hour Newbie friendliness 88/100
Maintainers usually reply within 4 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
-
Difficulty 1/5 Under an hour Newbie friendliness 91/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
duckdb/duckdb-wasm#2335 ·
Maintainers usually reply within 1 day