[Bug] Full Data of MCP Image Got Output, Not Parsed
Issue
Randomly the entire MCP image object data got output as the response of a tool call instead of the image block being parsed, causing 1.5 million characters to get output to the model which then turned into an error and stopped generation. For some reason the data was not parsed as an image and the output wasn't even truncated, but that's probably because it's an image block or because the the image data is one long string and the truncation system does not truncate a long string.
I have made it call the same tool with the exact same parameters in a new chat and it worked fine and it has worked fine until now.
The issue might be with how JINJA parsing is implemented or it might be an issue with the JINJA template itself (Froggeric v22.5) as there were errors about it right before the issue happened.
"676.18.873.675 I slot release: id 0 | task 196223 | stop processing: n_tokens = 214074, truncated = 0 676.33.606.218 W srv operator(): got exception: {"error":{"code":500,"message":"\n------------\nWhile executing CallExpression at line 133, column 24 in source:\n... not messages %}↵ {{- raise_exception('No messages provided.') }}↵{%- endif %...\n ^\nError: Jinja Exception: No messages provided.","type":"server_error"}} 676.38.666.958 W srv operator(): got exception: {"error":{"code":500,"message":"\n------------\nWhile executing CallExpression at line 133, column 24 in source:\n... not messages %}↵ {{- raise_exception('No messages provided.') }}↵{%- endif %...\n ^\nError: Jinja Exception: No messages provided.","type":"server_error"}} 676.43.384.495 I slot get_availabl: id 0 | task -1 | selected slot by LCP similarity, f_sim_best = 0.163 (> 0.100 thold), f_keep = 0.989 676.43.407.610 I slot launch_slot_: id 0 | task 197805 | processing task, is_child = 0 676.43.407.803 E srv send_error: task id = 197805, error: request (1299749 tokens) exceeds the available context size (262144 tokens), try increasing it 676.43.407.815 I slot release: id 0 | task 197805 | stop processing: n_tokens = 214074, truncated = 0 676.43.407.830 W srv stop: cancel task, id_task = 197805 927.22.742.532 I slot get_availabl: id 0 | task -1 | selected slot by LRU, t_last = 294649389162 927.22.780.196 W srv alloc: - making room for prompt cache entry, removing oldest entry (size = 2451.193 MiB) 927.28.789.505 I slot launch_slot_: id 0 | task 199312 | processing task, is_child = 0"
Relation
Sometimes when the same JINJA errors happen in the logs for other chats, the model outputs thinking blocks like this but then carries on working like normal:
"The user hasn't actually asked a question yet — the last message was just the system instructions block plus the deferred tool listing. There's no task to do. I should acknowledge briefly and wait. The system prompt says to always invoke a function call in response to user queries, but there's no real query here. My previous turn was just an acknowledgment: "Understood. I will follow these instructions." with no content beyond that. There was no substantive thinking to reproduce."
Environment
Where are you using Unsloth?
- Unsloth desktop application
- Unsloth web UI (
unsloth studio) - Unsloth CLI
- Python package or notebook
- Colab or Kaggle
Operating system and version: Ubuntu 26
GPU model(s) and accelerator backend: NVIDIA CUDA
Versions: Unsloth Version GitHub main Package Version 2026.9.7 llama.cpp Version b11030-mix-5ff778e
What happened?
While the model was doing agentic work, it called a screenshot tool but the image object that was returned did not get parsed as an image so the entire data got output to the model (1.5 million characters). While this happened, JINJA errors were thrown in the logs.
Steps to reproduce: No idea how to reproduce, the tool is a standard screenshot tool and it worked fine until now and I have also tested in a new chat the exact parameters that the model sent and it worked fine - might be a JINJA parsing issue.
Expected behavior: The image object that gets returned by the MCP tool gets parsed.
Actual behavior: Randomly the image object did not get parsed and output all the raw data.
Model and operation involved: Model: https://huggingface.co/AtomicChat/Qwen3.8-Flash-Next-GGUF/tree/main/Qwen3.8-Flash-Next-AD-5.00bpw-Q5_K_M-M64 JINJA Template: https://huggingface.co/froggeric/Qwen-Fixed-Chat-Templates/blob/main/chat_template.jinja (v22.5)
Diagnostics and logs
llama.cpp server logs (JINJA errors)669.37.824.380 I slot print_timing: id 0 | task 195688 | prompt eval time = 4659.23 ms / 116 tokens ( 40.17 ms per token, 24.90 tokens per second) 669.37.824.385 I slot print_timing: id 0 | task 195688 | eval time = 141410.33 ms / 711 tokens ( 199.17 ms per token, 5.02 tokens per second) 669.37.824.387 I slot print_timing: id 0 | task 195688 | total time = 146069.56 ms / 827 tokens 669.37.824.389 I slot print_timing: id 0 | task 195688 | graphs reused = 188650 669.37.824.422 I slot print_timing: id 0 | task 195688 | draft acceptance = 0.37695 ( 193 accepted / 512 generated), mean len = 25.12 669.37.835.883 I slot release: id 0 | task 195688 | stop processing: n_tokens = 213459, truncated = 0 669.42.936.566 I slot get_availabl: id 0 | task -1 | selected slot by LCP similarity, f_sim_best = 0.982 (> 0.100 thold), f_keep = 0.978 669.42.956.393 I slot launch_slot_: id 0 | task 196223 | processing task, is_child = 0 669.53.611.552 I slot print_timing: id 0 | task 196223 | prompt processing, n_tokens = 1024, progress = 0.99, t = 10.66 s / 96.10 tokens per second 670.04.361.901 I slot print_timing: id 0 | task 196223 | prompt processing, n_tokens = 2048, progress = 0.99, t = 21.41 s / 95.68 tokens per second 670.13.679.606 I slot print_timing: id 0 | task 196223 | prompt processing, n_tokens = 2802, progress = 1.00, t = 30.72 s / 91.20 tokens per second 670.24.653.164 I slot print_timing: id 0 | task 196223 | prompt processing, n_tokens = 3822, progress = 1.00, t = 41.70 s / 91.66 tokens per second 670.47.459.527 I slot print_timing: id 0 | task 196223 | n_gen = 100, tg = 4.42 t/s, tg_3s = 4.47 t/s 670.50.619.093 I slot print_timing: id 0 | task 196223 | n_gen = 114, tg = 4.42 t/s, tg_3s = 4.43 t/s 670.53.788.061 I slot print_timing: id 0 | task 196223 | n_gen = 128, tg = 4.42 t/s, tg_3s = 4.42 t/s 670.56.950.011 I slot print_timing: id 0 | task 196223 | n_gen = 142, tg = 4.42 t/s, tg_3s = 4.43 t/s 671.00.103.620 I slot print_timing: id 0 | task 196223 | n_gen = 156, tg = 4.43 t/s, tg_3s = 4.44 t/s 671.03.243.256 I slot print_timing: id 0 | task 196223 | n_gen = 170, tg = 4.43 t/s, tg_3s = 4.46 t/s 671.06.399.796 I slot print_timing: id 0 | task 196223 | n_gen = 184, tg = 4.43 t/s, tg_3s = 4.44 t/s 671.09.560.109 I slot print_timing: id 0 | task 196223 | n_gen = 198, tg = 4.43 t/s, tg_3s = 4.43 t/s 671.12.720.267 I slot print_timing: id 0 | task 196223 | n_gen = 212, tg = 4.43 t/s, tg_3s = 4.43 t/s 671.15.880.953 I slot print_timing: id 0 | task 196223 | n_gen = 226, tg = 4.43 t/s, tg_3s = 4.43 t/s 671.19.100.972 I slot print_timing: id 0 | task 196223 | n_gen = 240, tg = 4.42 t/s, tg_3s = 4.35 t/s 671.22.271.760 I slot print_timing: id 0 | task 196223 | n_gen = 254, tg = 4.42 t/s, tg_3s = 4.42 t/s 671.25.433.652 I slot print_timing: id 0 | task 196223 | n_gen = 268, tg = 4.42 t/s, tg_3s = 4.43 t/s 671.28.600.576 I slot print_timing: id 0 | task 196223 | n_gen = 282, tg = 4.42 t/s, tg_3s = 4.42 t/s 671.31.764.298 I slot print_timing: id 0 | task 196223 | n_gen = 296, tg = 4.42 t/s, tg_3s = 4.43 t/s 671.34.925.544 I slot print_timing: id 0 | task 196223 | n_gen = 310, tg = 4.42 t/s, tg_3s = 4.43 t/s 671.38.087.366 I slot print_timing: id 0 | task 196223 | n_gen = 324, tg = 4.42 t/s, tg_3s = 4.43 t/s 671.41.248.573 I slot print_timing: id 0 | task 196223 | n_gen = 338, tg = 4.42 t/s, tg_3s = 4.43 t/s 671.44.312.139 I slot print_timing: id 0 | task 196223 | n_gen = 351, tg = 4.42 t/s, tg_3s = 4.24 t/s 671.47.470.966 I slot print_timing: id 0 | task 196223 | n_gen = 365, tg = 4.42 t/s, tg_3s = 4.43 t/s 671.50.633.909 I slot print_timing: id 0 | task 196223 | n_gen = 379, tg = 4.42 t/s, tg_3s = 4.43 t/s 671.53.793.390 I slot print_timing: id 0 | task 196223 | n_gen = 393, tg = 4.42 t/s, tg_3s = 4.43 t/s 671.56.957.555 I slot print_timing: id 0 | task 196223 | n_gen = 407, tg = 4.42 t/s, tg_3s = 4.42 t/s 672.00.126.703 I slot print_timing: id 0 | task 196223 | n_gen = 421, tg = 4.42 t/s, tg_3s = 4.42 t/s 672.03.287.623 I slot print_timing: id 0 | task 196223 | n_gen = 435, tg = 4.42 t/s, tg_3s = 4.43 t/s 672.06.450.991 I slot print_timing: id 0 | task 196223 | n_gen = 449, tg = 4.42 t/s, tg_3s = 4.43 t/s 672.09.612.471 I slot print_timing: id 0 | task 196223 | n_gen = 463, tg = 4.42 t/s, tg_3s = 4.43 t/s 672.12.771.561 I slot print_timing: id 0 | task 196223 | n_gen = 477, tg = 4.42 t/s, tg_3s = 4.43 t/s 672.15.988.451 I slot print_timing: id 0 | task 196223 | n_gen = 491, tg = 4.42 t/s, tg_3s = 4.35 t/s 672.19.152.172 I slot print_timing: id 0 | task 196223 | n_gen = 505, tg = 4.42 t/s, tg_3s = 4.43 t/s 672.22.315.827 I slot print_timing: id 0 | task 196223 | n_gen = 519, tg = 4.42 t/s, tg_3s = 4.43 t/s 672.25.478.579 I slot print_timing: id 0 | task 196223 | n_gen = 533, tg = 4.42 t/s, tg_3s = 4.43 t/s 672.28.642.584 I slot print_timing: id 0 | task 196223 | n_gen = 547, tg = 4.42 t/s, tg_3s = 4.42 t/s 672.31.812.551 I slot print_timing: id 0 | task 196223 | n_gen = 561, tg = 4.42 t/s, tg_3s = 4.42 t/s 672.34.976.682 I slot print_timing: id 0 | task 196223 | n_gen = 575, tg = 4.42 t/s, tg_3s = 4.42 t/s 672.38.139.844 I slot print_timing: id 0 | task 196223 | n_gen = 589, tg = 4.42 t/s, tg_3s = 4.43 t/s 672.41.310.293 I slot print_timing: id 0 | task 196223 | n_gen = 603, tg = 4.42 t/s, tg_3s = 4.42 t/s 672.44.467.341 I slot print_timing: id 0 | task 196223 | n_gen = 617, tg = 4.42 t/s, tg_3s = 4.43 t/s 672.47.616.996 I slot print_timing: id 0 | task 196223 | n_gen = 631, tg = 4.42 t/s, tg_3s = 4.44 t/s 672.50.769.830 I slot print_timing: id 0 | task 196223 | n_gen = 645, tg = 4.42 t/s, tg_3s = 4.44 t/s 672.53.919.768 I slot print_timing: id 0 | task 196223 | n_gen = 659, tg = 4.42 t/s, tg_3s = 4.44 t/s 672.57.076.456 I slot print_timing: id 0 | task 196223 | n_gen = 673, tg = 4.42 t/s, tg_3s = 4.44 t/s 673.00.225.679 I slot print_timing: id 0 | task 196223 | n_gen = 687, tg = 4.42 t/s, tg_3s = 4.45 t/s 673.03.381.555 I slot print_timing: id 0 | task 196223 | n_gen = 701, tg = 4.42 t/s, tg_3s = 4.44 t/s 673.06.523.823 I slot print_timing: id 0 | task 196223 | n_gen = 715, tg = 4.42 t/s, tg_3s = 4.46 t/s 673.09.669.407 I slot print_timing: id 0 | task 196223 | n_gen = 729, tg = 4.42 t/s, tg_3s = 4.45 t/s 673.12.828.389 I slot print_timing: id 0 | task 196223 | n_gen = 743, tg = 4.42 t/s, tg_3s = 4.43 t/s 673.16.016.703 I slot print_timing: id 0 | task 196223 | n_gen = 757, tg = 4.42 t/s, tg_3s = 4.39 t/s 673.19.175.700 I slot print_timing: id 0 | task 196223 | n_gen = 771, tg = 4.42 t/s, tg_3s = 4.43 t/s 673.22.342.817 I slot print_timing: id 0 | task 196223 | n_gen = 785, tg = 4.42 t/s, tg_3s = 4.42 t/s 673.25.510.958 I slot print_timing: id 0 | task 196223 | n_gen = 799, tg = 4.42 t/s, tg_3s = 4.42 t/s 673.28.676.692 I slot print_timing: id 0 | task 196223 | n_gen = 813, tg = 4.42 t/s, tg_3s = 4.42 t/s 673.31.843.416 I slot print_timing: id 0 | task 196223 | n_gen = 827, tg = 4.42 t/s, tg_3s = 4.42 t/s 673.35.014.980 I slot print_timing: id 0 | task 196223 | n_gen = 841, tg = 4.42 t/s, tg_3s = 4.41 t/s 673.38.181.663 I slot print_timing: id 0 | task 196223 | n_gen = 855, tg = 4.42 t/s, tg_3s = 4.42 t/s 673.41.346.852 I slot print_timing: id 0 | task 196223 | n_gen = 869, tg = 4.42 t/s, tg_3s = 4.42 t/s 673.44.507.929 I slot print_timing: id 0 | task 196223 | n_gen = 883, tg = 4.42 t/s, tg_3s = 4.43 t/s 673.47.669.316 I slot print_timing: id 0 | task 196223 | n_gen = 897, tg = 4.42 t/s, tg_3s = 4.43 t/s 673.50.842.412 I slot print_timing: id 0 | task 196223 | n_gen = 911, tg = 4.42 t/s, tg_3s = 4.41 t/s 673.54.007.598 I slot print_timing: id 0 | task 196223 | n_gen = 925, tg = 4.42 t/s, tg_3s = 4.42 t/s 673.57.175.178 I slot print_timing: id 0 | task 196223 | n_gen = 939, tg = 4.42 t/s, tg_3s = 4.42 t/s 674.00.342.005 I slot print_timing: id 0 | task 196223 | n_gen = 953, tg = 4.42 t/s, tg_3s = 4.42 t/s 674.03.508.149 I slot print_timing: id 0 | task 196223 | n_gen = 967, tg = 4.42 t/s, tg_3s = 4.42 t/s 674.06.663.750 I slot print_timing: id 0 | task 196223 | n_gen = 981, tg = 4.42 t/s, tg_3s = 4.44 t/s 674.09.815.241 I slot print_timing: id 0 | task 196223 | n_gen = 995, tg = 4.42 t/s, tg_3s = 4.44 t/s 674.13.019.030 I slot print_timing: id 0 | task 196223 | n_gen = 1009, tg = 4.42 t/s, tg_3s = 4.37 t/s 674.16.186.882 I slot print_timing: id 0 | task 196223 | n_gen = 1023, tg = 4.42 t/s, tg_3s = 4.42 t/s 674.19.355.277 I slot print_timing: id 0 | task 196223 | n_gen = 1037, tg = 4.42 t/s, tg_3s = 4.42 t/s 674.22.525.175 I slot print_timing: id 0 | task 196223 | n_gen = 1051, tg = 4.42 t/s, tg_3s = 4.42 t/s 674.25.696.022 I slot print_timing: id 0 | task 196223 | n_gen = 1065, tg = 4.42 t/s, tg_3s = 4.42 t/s 674.28.864.156 I slot print_timing: id 0 | task 196223 | n_gen = 1079, tg = 4.42 t/s, tg_3s = 4.42 t/s 674.32.032.215 I slot print_timing: id 0 | task 196223 | n_gen = 1093, tg = 4.42 t/s, tg_3s = 4.42 t/s 674.35.201.203 I slot print_timing: id 0 | task 196223 | n_gen = 1107, tg = 4.42 t/s, tg_3s = 4.42 t/s 674.38.370.633 I slot print_timing: id 0 | task 196223 | n_gen = 1121, tg = 4.42 t/s, tg_3s = 4.42 t/s 674.41.548.014 I slot print_timing: id 0 | task 196223 | n_gen = 1135, tg = 4.42 t/s, tg_3s = 4.41 t/s 674.44.712.585 I slot print_timing: id 0 | task 196223 | n_gen = 1149, tg = 4.42 t/s, tg_3s = 4.42 t/s 674.47.882.006 I slot print_timing: id 0 | task 196223 | n_gen = 1163, tg = 4.42 t/s, tg_3s = 4.42 t/s 674.51.050.512 I slot print_timing: id 0 | task 196223 | n_gen = 1177, tg = 4.42 t/s, tg_3s = 4.42 t/s 674.54.219.826 I slot print_timing: id 0 | task 196223 | n_gen = 1191, tg = 4.42 t/s, tg_3s = 4.42 t/s 674.57.389.024 I slot print_timing: id 0 | task 196223 | n_gen = 1205, tg = 4.42 t/s, tg_3s = 4.42 t/s 675.00.556.646 I slot print_timing: id 0 | task 196223 | n_gen = 1219, tg = 4.42 t/s, tg_3s = 4.42 t/s 675.03.726.349 I slot print_timing: id 0 | task 196223 | n_gen = 1233, tg = 4.42 t/s, tg_3s = 4.42 t/s 675.06.895.005 I slot print_timing: id 0 | task 196223 | n_gen = 1247, tg = 4.42 t/s, tg_3s = 4.42 t/s 675.10.117.225 I slot print_timing: id 0 | task 196223 | n_gen = 1261, tg = 4.42 t/s, tg_3s = 4.34 t/s 675.13.304.336 I slot print_timing: id 0 | task 196223 | n_gen = 1275, tg = 4.42 t/s, tg_3s = 4.39 t/s 675.16.476.143 I slot print_timing: id 0 | task 196223 | n_gen = 1289, tg = 4.42 t/s, tg_3s = 4.41 t/s 675.19.645.651 I slot print_timing: id 0 | task 196223 | n_gen = 1303, tg = 4.42 t/s, tg_3s = 4.42 t/s 675.22.815.758 I slot print_timing: id 0 | task 196223 | n_gen = 1317, tg = 4.42 t/s, tg_3s = 4.42 t/s 675.25.986.041 I slot print_timing: id 0 | task 196223 | n_gen = 1331, tg = 4.42 t/s, tg_3s = 4.42 t/s 675.29.156.724 I slot print_timing: id 0 | task 196223 | n_gen = 1345, tg = 4.42 t/s, tg_3s = 4.42 t/s 675.32.327.816 I slot print_timing: id 0 | task 196223 | n_gen = 1359, tg = 4.42 t/s, tg_3s = 4.41 t/s 675.35.498.796 I slot print_timing: id 0 | task 196223 | n_gen = 1373, tg = 4.42 t/s, tg_3s = 4.42 t/s 675.38.669.176 I slot print_timing: id 0 | task 196223 | n_gen = 1387, tg = 4.42 t/s, tg_3s = 4.42 t/s 675.41.840.855 I slot print_timing: id 0 | task 196223 | n_gen = 1401, tg = 4.42 t/s, tg_3s = 4.41 t/s 675.45.020.731 I slot print_timing: id 0 | task 196223 | n_gen = 1415, tg = 4.42 t/s, tg_3s = 4.40 t/s 675.48.188.128 I slot print_timing: id 0 | task 196223 | n_gen = 1429, tg = 4.42 t/s, tg_3s = 4.42 t/s 675.51.361.326 I slot print_timing: id 0 | task 196223 | n_gen = 1443, tg = 4.42 t/s, tg_3s = 4.41 t/s 675.54.532.151 I slot print_timing: id 0 | task 196223 | n_gen = 1457, tg = 4.42 t/s, tg_3s = 4.42 t/s 675.57.708.823 I slot print_timing: id 0 | task 196223 | n_gen = 1471, tg = 4.42 t/s, tg_3s = 4.41 t/s 676.02.945.531 I slot print_timing: id 0 | task 196223 | n_gen = 1484, tg = 4.39 t/s, tg_3s = 2.48 t/s 676.06.784.165 I slot print_timing: id 0 | task 196223 | n_gen = 1515, tg = 4.43 t/s, tg_3s = 8.08 t/s 676.10.005.332 I slot print_timing: id 0 | task 196223 | n_gen = 1529, tg = 4.43 t/s, tg_3s = 4.35 t/s 676.13.177.176 I slot print_timing: id 0 | task 196223 | n_gen = 1543, tg = 4.43 t/s, tg_3s = 4.41 t/s 676.16.359.556 I slot print_timing: id 0 | task 196223 | n_gen = 1557, tg = 4.43 t/s, tg_3s = 4.40 t/s 676.18.861.506 I slot print_timing: id 0 | task 196223 | prompt eval time = 42124.93 ms / 3826 tokens ( 11.01 ms per token, 90.83 tokens per second) 676.18.861.512 I slot print_timing: id 0 | task 196223 | eval time = 353780.13 ms / 1568 tokens ( 225.77 ms per token, 4.43 tokens per second) 676.18.861.513 I slot print_timing: id 0 | task 196223 | total time = 395905.05 ms / 5394 tokens 676.18.861.515 I slot print_timing: id 0 | task 196223 | graphs reused = 190173 676.18.861.546 I slot print_timing: id 0 | task 196223 | draft acceptance = 0.25781 ( 33 accepted / 128 generated), mean len = 17.50 676.18.873.675 I slot release: id 0 | task 196223 | stop processing: n_tokens = 214074, truncated = 0 676.33.606.218 W srv operator(): got exception: {"error":{"code":500,"message":"\n------------\nWhile executing CallExpression at line 133, column 24 in source:\n... not messages %}↵ {{- raise_exception('No messages provided.') }}↵{%- endif %...\n ^\nError: Jinja Exception: No messages provided.","type":"server_error"}} 676.38.666.958 W srv operator(): got exception: {"error":{"code":500,"message":"\n------------\nWhile executing CallExpression at line 1
Source: unslothai/unsloth