{"slug": "ui-tars-desktop-cancels-every-step-at-30-seconds-it-s-a-hard-coded-timeout-how", "title": "UI-TARS Desktop cancels every step at 30 seconds? It's a hard-coded timeout — how to prove it, and what the fix involves", "summary": "A developer traced UI-TARS Desktop v0.2.4's recurring \"Connection error\" failures to a hard-coded 30-second request timeout — the literal `timeout: 3e4` — appearing in two places inside `invokeModelProvider` in the app's bundled `dist/main/main.js`. Field logs on a modded RX 580 rig running UI-TARS-1.5-7B via llama.cpp showed no completed agent step ever exceeded 28.1 seconds while failed steps were cancelled at 27.2 and 29.6 seconds, with the server log clean throughout. The developer argues a healthy `/v1/models` response and an error-free server log rule out the model, GPU and VRAM, pointing instead to the client-side timeout.", "body_md": "This is the second article in this series. The [first one](https://dev.to/barrcreations3d/running-llamacpp-and-stable-diffusioncpp-on-an-rx-580-polaris-via-vulkan-on-windows-when-rocm-1hni) covered getting local AI running on a Polaris card via Vulkan at all. This one is about a single defect that nearly ended the desktop-agent part of that project on its first evening — and that will eat yours too if you run UI-TARS Desktop against a local model server on modest hardware.\n\nThe rig, for reference: a modded RX 580 (Polaris, gfx803) with 16 GB of VRAM, a 2-core Celeron with no AVX2, 16 GB of DDR4, Windows 11. The stack: UI-TARS-1.5-7B served by llama.cpp's `llama-server`, driven by **UI-TARS Desktop v0.2.4** — the last release of the Desktop line, which is now archived. Everything below was proven against that version specifically.\n\nThe agent starts a task. The first step or two complete. Then a step runs long — and at roughly 30 seconds it is cancelled and reported as a **\"Connection error.\"** The run dies or retries pointlessly. Meanwhile, the llama-server log is *perfectly clean*: no crash, no error, no out-of-memory, nothing. The server was still working on its answer when the app stopped listening.\n\nThat combination — steps dying at a suspiciously round number, with a healthy server — is the whole story. The rest of this article is proving it and understanding what fixing it actually takes.\n\nBecause the error says \"Connection,\" people debug the connection. They restart the server. They try a different model. They check the base URL, the port, the firewall, the API-key field. They reinstall. They blame the graphics card, because on legacy hardware the card is guilty until proven innocent.\n\nNone of it helps, because none of it is the problem. Two observations rule the whole server side out before you touch anything:\n\n**A clean server log is evidence, not an absence of it.** If the model, the card, or VRAM were failing, llama-server would say so — it is not shy about logging allocation failures and device losses. A log that shows the request arriving and generation proceeding normally, right up until the client vanishes, is the server testifying that it was fine.\n\n**A bound port proves nothing — but the model list does.** llama-server binds its port *before* the model finishes loading, so \"the port answers\" is not proof of health. The check that counts is the model alias answering at `http://127.0.0.1:8080/v1/models`. If your alias is listed there, the server is up, loaded, and serving. Whatever is killing your steps, it is downstream of a healthy server.\n\nHere is the evidence that convicted the app, from a full day of field logs on the rig above.\n\nOn this class of hardware, a legitimate agent step — screenshot, vision encode, model thinking, action out — takes **20 to 28 seconds**. That is normal. It is also, notice, uncomfortably close to 30.\n\nNow the fingerprint: **in an entire day of logs, no completed step ever exceeded 28.1 seconds.** Not one. And the steps that died were cancelled at **27.2 s and 29.6 s**. Think about what that means. Real work has a distribution — some steps at 19 s, some at 24 s, occasionally one at 34 s that still finishes. A hard ceiling that no successful step ever crosses, with failures clustered just under it, is not a distribution. It is a guillotine. Something was cutting every request at the same height, and 28.1 s was simply the longest step that ever squeezed under the blade.\n\nIf your steps die at random times *with* errors in the server log, you have a different failure — work the server side. But if they die at ~27–30 s against a clean log, you have this one.\n\nUI-TARS Desktop 0.2.4 hard-codes a 30-second timeout on model requests: the literal **`timeout: 3e4`** — 3e4 is 30,000 milliseconds — in **two places** inside `invokeModelProvider` in the app's bundled `dist/main/main.js` (in the 0.2.4 build they sit at lines 73336 and 73363, one for each of the app's two model-call paths). There is no settings field for it. No config file exposes it. It is a constant, compiled into the bundle, chosen by someone who presumably assumed the model would be a fast cloud API. Against a local model on a 2-core machine, 30 seconds is not a timeout — it's a coin flip that lands wrong a third of the time.\n\nYou don't need my logs. Run these checks in order:\n\n`http://127.0.0.1:8080/v1/models` in a browser. Your model alias should be listed. Server: innocent.`app.asar` in the install folder. Extract it (or search an extracted copy) and look in `dist/main/main.js` for `timeout: 3e4` near `invokeModelProvider`. Two occurrences in 0.2.4. One caution from the field: search anchored on the `timeout:` property — a bare `30000` also appears in port numbers and animation delays, and those are not yours to change.\nIf all four line up, you don't have a server problem, a model problem, or a hardware problem. You have a constant.\n\nAt orientation level, the fix is simple to state: raise both timeouts from `3e4` to `6e5` — ten minutes — so a slow local step is allowed to finish. And after patching, the proof was unambiguous: pointed at a deliberately slow CPU-encode server whose steps used to die at 29.6 s, the patched app completed model invokes of **300, 298, and 372 seconds**. The wall was the app. It always was.\n\nWhat makes it a *job* rather than an edit is everything around that one-line change:\n\n`UI-TARS.exe`, copied somewhere safe before you touch anything. Restoring those three returns the app to stock, untouched.\nThis is also why I'd argue for a *scripted* patch over hand-editing: a script can anchor on the `timeout:` property (and only that), count its replacements, recompute both hashes from the archives, swap the new one in, and verify its own work before declaring success. A hex editor does none of that, and the failure mode of getting it wrong is an app that won't start and no note about why. One more honesty note: this patch is **version-specific**. It was proven on Desktop 0.2.4; another build may word or place the value differently, and any tooling worth using should report \"not found\" rather than guess.\n\nRaising the wall buys you room; it doesn't make steps quick. Two settings decide how long a step takes on this stack, and readers hitting the timeout usually need both:\n\n**Offload the vision projector.** Launch llama-server with `--mmproj-offload` so the screenshot encode runs on the GPU. Without it, the encode runs on the CPU — on the 2-core field rig that took **~85 seconds per screenshot**, and every step died waiting (that was true even before the timeout entered the picture). With the projector on the GPU, steps land around **~20 seconds**.\n\n**Cap the vision tokens.** `--image-max-tokens 768` is the field-proven setting. Uncapped, the vision encode crashed the graphics card outright (`ggml_vulkan: device lost`). At 512 the agent is stable but can't aim — clicks land wrong. At 1024 it aims best but steps run 25–28 s, which is precisely why that setting was unusable until the timeout was patched. Hold the server context at `-c 8192` while you're at it: the agent's memory is screenshots, and every remembered screen costs roughly a thousand tokens.\n\nThe known-good launch line, for reference:\n\n```\nllama-server.exe -m <UI-TARS-1.5-7B.gguf> --mmproj <mmproj.gguf> --mmproj-offload -ngl 999 -c 8192 --jinja --image-max-tokens 768 -a UI-TARS-1.5-7B --host 127.0.0.1 --port 8080\n```\n\nThe timeout was the mechanical failure. The other failure mode is asking the agent to do too much per run, and no patch fixes that:\n\n`ms-settings:` routes beat menu-hunting every time: every menu hunted is steps, tokens, and chances to get lost.\nThe proof it all works together: with the GPU server at the 768 cap and the patched app, the task *\"Press Win+R, type ms-settings:display, press Enter, tell me the display resolution\"* ran clean to completion and reported **1920 × 1080** — correct. A 2-core Celeron and a 2017 graphics card, driving Windows by itself, once the app stopped hanging up on it mid-sentence.\n\nFull disclosure: these are my own products, built from the exact notes above.\n\nThe patch described here — the timeout fix, the repack, the hash swap, all scripted with a dry-run first and self-verification, plus the context-pruning settings — is packaged as an agent skill on Agensi: [UI-TARS Timeout Patch & Context Pruner](https://agensi.io/skills/ui-tars-timeout-patch-context-pruner), $9.99. An AI assistant with that skill applies the whole procedure to your machine instead of you hand-editing an archive at midnight.\n\nThe other three pieces of the stack are skills too:\n\nThe full written version is my playbook, *Local AI on Hardware the Big Tools Gave Up On*: the [$19 playbook](https://nickbarr3d.gumroad.com/l/local-ai-legacy-hardware-playbook), or the [$29 bundle](https://nickbarr3d.gumroad.com/l/local-ai-workstation-bundle) with the working scripts — including the timeout patcher and hash swapper — and the control deck source. Everything lives on my creator page: [agensi.io/creators/nick-2](https://agensi.io/creators/nick-2).\n\nAnd if you're starting from zero on the hardware side, the first article in this series covers the full Vulkan setup — the dead ends, the launch lines, and the context ladder — that this one builds on.\n\nEither way: time your steps before you debug anything. The clock knew the answer the whole time.", "url": "https://wpnews.pro/news/ui-tars-desktop-cancels-every-step-at-30-seconds-it-s-a-hard-coded-timeout-how", "canonical_source": "https://dev.to/barrcreations3d/ui-tars-desktop-cancels-every-step-at-30-seconds-its-a-hard-coded-timeout-how-to-prove-it-and-2p0k", "published_at": "2026-12-05 20:33:49+00:00", "updated_at": "2026-12-05 20:44:37.579571+00:00", "lang": "en", "topics": ["ai-agents", "ai-tools", "large-language-models", "ai-infrastructure"], "entities": ["UI-TARS Desktop", "UI-TARS-1.5-7B", "llama.cpp", "llama-server", "AMD", "Windows 11"], "also_reported_by": [], "takeaway": "UI-TARS Desktop 0.2.4 cancels model requests at a hard-coded 30-second timeout (`timeout: 3e4` in `invokeModelProvider`), so steps on slow hardware that legitimately take 20–28 seconds fail as \"Connection error\" even when llama-server logs no fault.", "recommendation": {"advice": "When agent steps fail at a suspiciously round interval with a clean server log, check the client's request timeout before debugging the model or GPU.", "playbook": "production-ops", "playbook_url": "https://wpnews.pro/playbooks/production-ops"}, "alternates": {"html": "https://wpnews.pro/news/ui-tars-desktop-cancels-every-step-at-30-seconds-it-s-a-hard-coded-timeout-how", "markdown": "https://wpnews.pro/news/ui-tars-desktop-cancels-every-step-at-30-seconds-it-s-a-hard-coded-timeout-how.md", "text": "https://wpnews.pro/news/ui-tars-desktop-cancels-every-step-at-30-seconds-it-s-a-hard-coded-timeout-how.txt", "jsonld": "https://wpnews.pro/news/ui-tars-desktop-cancels-every-step-at-30-seconds-it-s-a-hard-coded-timeout-how.jsonld"}}