runtimeverification / runtimeverification/haskell-backend
`kore-rpc` returns error response on request with Unicode character
Nobody has claimed this yet.
- Dominant language
- Haskell
- Stars
- 224
- Forks
- 43
- PR merge metrics
- No merged PRs in 30d
Description
For a request that contains Unicode characters within a string (either escaped or not), kore-rpc returns error -32602 Invalid params.
Steps to reproduce
$ kompile string-rewrite.k --backend haskell
$ kore-rpc string-rewrite-kompiled/definition.kore --module STRING-REWRITE --server-port 3000
$ netcat -q 0 localhost 3000 < request.json
{"jsonrpc":"2.0","id":1,"error":{"code":-32602,"data":{"state":{"format":"KORE","version":1,"term":{"tag":"App","name":"Lbl'-LT-'generatedTop'-GT-'","sorts":[],"args":[{"tag":"App","name":"Lbl'-LT-'k'-GT-'","sorts":[],"args":[{"tag":"App","name":"kseq","sorts":[],"args":[{"tag":"App","name":"inj","sorts":[{"tag":"SortApp","name":"SortString","args":[]},{"tag":"SortApp","name":"SortKItem","args":[]}],"args":[{"tag":"DV","sort":{"tag":"SortApp","name":"SortString","args":[]},"value":"🙂"}]},{"tag":"App","name":"dotk","sorts":[],"args":[]}]}]},{"tag":"App","name":"Lbl'-LT-'generatedCounter'-GT-'","sorts":[],"args":[{"tag":"DV","sort":{"tag":"SortApp","name":"SortInt","args":[]},"value":"0"}]},{"tag":"App","name":"Lbl'-LT-'s'-GT-'","sorts":[],"args":[{"tag":"DV","sort":{"tag":"SortApp","name":"SortString","args":[]},"value":""}]}]}}},"message":"Invalid params"}}
The error is due to
{
"tag": "DV",
"sort": {
"tag": "SortApp",
"name": "SortString",
"args": []
},
"value": "\ud83d\ude42"
}
on lines 40-47 of request.json. If the value is changed to
"value": "🙂"
the error is still there. Note that both strings are well-formed JSON strings (standard, see section 2.5).
If the value it's changed to
"value": "hello"
the request works as expected:
{"jsonrpc":"2.0","id":1,"result":{"reason":"stuck","depth":1,"state":{"term":{"format":"KORE","version":1,"term":{"tag":"App","name":"Lbl'-LT-'generatedTop'-GT-'","sorts":[],"args":[{"tag":"App","name":"Lbl'-LT-'k'-GT-'","sorts":[],"args":[{"tag":"App","name":"dotk","sorts":[],"args":[]}]},{"tag":"App","name":"Lbl'-LT-'generatedCounter'-GT-'","sorts":[],"args":[{"tag":"DV","sort":{"tag":"SortApp","name":"SortInt","args":[]},"value":"0"}]},{"tag":"App","name":"Lbl'-LT-'s'-GT-'","sorts":[],"args":[{"tag":"DV","sort":{"tag":"SortApp","name":"SortString","args":[]},"value":"hello"}]}]}}}}}
Contributor guide
No contributing guide indexed for this repository
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.
Research direction
Reproduce the failure with string-rewrite.k, request.json, kompile, and the kore-rpc entry point. Trace how kore-rpc handles the SortString DV value for both escaped and literal Unicode, then verify that both request forms succeed while the existing ASCII case remains working.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100