[GH-ISSUE #155] Encode crash #83

Closed
opened 2026-11-04 01:39:42 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @narrowengineer on GitHub (Sep 29, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/155

Exception occurred during processing of request from ('192.168.1.125', 55711)
Traceback (most recent call last):
File "C:\Users\steve\AppData\Local\Programs\Python\Python312\Lib\socketserver.py", line 697, in process_request_thread
self.finish_request(request, client_address)
File "C:\Users\steve\AppData\Local\Programs\Python\Python312\Lib\socketserver.py", line 362, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "C:\Users\steve\AppData\Local\Programs\Python\Python312\Lib\socketserver.py", line 766, in init
self.handle()
File "C:\Users\steve\AppData\Local\Programs\Python\Python312\Lib\http\server.py", line 436, in handle
self.handle_one_request()
File "C:\Users\steve\AppData\Local\Programs\Python\Python312\Lib\http\server.py", line 424, in handle_one_request
method()
File "C:\ai_server\Strata-main\serve\server.py", line 1188, in do_POST
self._openai(req)
File "C:\ai_server\Strata-main\serve\server.py", line 1244, in _openai
ids, thinking, max_new = svc.prepare(messages, tools, kw, max_new)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\ai_server\Strata-main\serve\server.py", line 620, in prepare
ids = self.tok.encode(prompt, parse_special=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\ai_server\Strata-main\tools\strata_tokenizer.py", line 195, in encode
return self._encode_matching(text, self._special_re if parse_special else self._always_re)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\ai_server\Strata-main\tools\strata_tokenizer.py", line 182, in _encode_matching
out.extend(self._encode_plain(text[pos:m.start()]))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\ai_server\Strata-main\tools\strata_tokenizer.py", line 161, in _encode_plain
mapped = "".join(BYTE_TO_UNICODE[b] for b in piece.encode("utf-8"))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: 'bytes' object is not callable

Originally created by @narrowengineer on GitHub (Sep 29, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/155 Exception occurred during processing of request from ('192.168.1.125', 55711) Traceback (most recent call last): File "C:\Users\steve\AppData\Local\Programs\Python\Python312\Lib\socketserver.py", line 697, in process_request_thread self.finish_request(request, client_address) File "C:\Users\steve\AppData\Local\Programs\Python\Python312\Lib\socketserver.py", line 362, in finish_request self.RequestHandlerClass(request, client_address, self) File "C:\Users\steve\AppData\Local\Programs\Python\Python312\Lib\socketserver.py", line 766, in __init__ self.handle() File "C:\Users\steve\AppData\Local\Programs\Python\Python312\Lib\http\server.py", line 436, in handle self.handle_one_request() File "C:\Users\steve\AppData\Local\Programs\Python\Python312\Lib\http\server.py", line 424, in handle_one_request method() File "C:\ai_server\Strata-main\serve\server.py", line 1188, in do_POST self._openai(req) File "C:\ai_server\Strata-main\serve\server.py", line 1244, in _openai ids, thinking, max_new = svc.prepare(messages, tools, kw, max_new) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\ai_server\Strata-main\serve\server.py", line 620, in prepare ids = self.tok.encode(prompt, parse_special=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\ai_server\Strata-main\tools\strata_tokenizer.py", line 195, in encode return self._encode_matching(text, self._special_re if parse_special else self._always_re) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\ai_server\Strata-main\tools\strata_tokenizer.py", line 182, in _encode_matching out.extend(self._encode_plain(text[pos:m.start()])) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\ai_server\Strata-main\tools\strata_tokenizer.py", line 161, in _encode_plain mapped = "".join(BYTE_TO_UNICODE[b] for b in piece.encode("utf-8")) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: 'bytes' object is not callable ----------------------------------------
Author
Owner

@Niko1221 commented on GitHub (Sep 29, 2026):

Thanks for the trace. That line (piece.encode("utf-8")) can't raise this error for ordinary text, and together with #147 it looks like the Python process itself is getting corrupted. Please update to 0.1.26, reinstall the packages (pip install --force-reinstall regex numpy in Strata's venv), and reopen with the request that triggers it if it happens again.

<!-- gh-comment-id:5898174770 --> @Niko1221 commented on GitHub (Sep 29, 2026): Thanks for the trace. That line (`piece.encode("utf-8")`) can't raise this error for ordinary text, and together with #147 it looks like the Python process itself is getting corrupted. Please update to 0.1.26, reinstall the packages (`pip install --force-reinstall regex numpy` in Strata's venv), and reopen with the request that triggers it if it happens again.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#83
No description provided.