a month ago
I have an app using openclaw on Railway. It has been working fine. I use Telegram to interact with it as the gateway browser keeps losing the token so i can't login that way after the first use.
I have constructed multiple agents and group chats and topics. all good.
Now when I message the agent I get this message
Agent failed before reply
Model context window too small )81192 tokens) Minimum is 16000
Logs: openclaw logs --follow.
I have no clue. it just stopped. If i redeploy the app in my project, the same message appears in telegram.
And as I can not get into the railway app via the browser due to the token issue, I am a bit stuck.
Does anyone have some advice here?
7 Replies
Status changed to Open Railway • about 2 months ago
a month ago
Do you have a contextWindow defined in any file like openclaw.json or some other config file?
a month ago
Try /compact via Telegram or delete session files
a month ago
it seems as though it is missing an api to ollama. I had the agent change to ollama. internally. all was going fine. The agent was working on some tasks when poof, that error popped up and I do not know where to even atttempt to fix it. I can cli ssh into the app on Railway, but I have no way of editing the json files as there is no editor
a month ago
Hello simplyict,
i think ur problem is that when you switched to ollama, openclaw defaulted to a 4096 token context window which is below the 16000 minimum it needs to run. this is a bug with ollama as a custom provider in openclaw
to fix it without needing an editor, run this via your railway ssh:
openclaw config set agents.defaults.contextTokens 200000 --strict-json
then restart the app
Hope this help you :)
a month ago
ok so yesterday after a few hours, the agent started to respond. no more errors with 8192 tokens needing 16000 messages. worked until today when I noticed that he was not himself and was reporting errors in our app that he monitors. he also did not shutdown the external link to openrouter and was still using it. so I told him to buckle up and fix the issues. the agent then said he was redoing everything and said that he was now completely isolated from openrouter and running internally on ollama. then all of a sudden we are back to the token issue. Agent failed before reply: Model context window too small (8192 tokens). Minimum is 16000.
Logs: openclaw logs --follow
I have tried the statement to set to 20000 then restarted the app. still the same Agent failed before reply: Model context window too small (8192 tokens). Minimum is 16000.
Logs: openclaw logs --follow
a month ago
okay then your problem is a openclaw bug where it keeps misreading the ollama context window as 8192 even after you set it manually, and when your agent "redid everything" it wiped your config change entirely. the config set command doesnt actually persist properly in this case. first thing to try via your railway ssh is run openclaw doctor, this is a built in command that will detect the mismatch and tell you what is wrong and where. that gives you the real info to fix it properly without guessing at json files you cant edit
a month ago
anytime I run the oppenclaw doctor command I get a missing token
I did run a backup before this all started which I have locally, but see no way to restore a backup on the cli.