Skip to content

Ollama: rnj-1 model generates infinitely with literal stop tokens in output #47798

@doncarlosx

Description

@doncarlosx

Reproduction steps

  1. Install Ollama 0.15.2 and pull rnj-1:8b model (ollama pull rnj-1:8b)
  2. Configure Zed to use Ollama with rnj-1:8b as the model for Agent Panel or Inline Assist
  3. Open the Agent Panel and send any prompt (e.g., "Please write a function that prints hello world")
  4. Observe the model generates a response, then immediately generates another nearly-identical response, looping indefinitely until manually interrupted

The same behavior occurs with Inline Assist.

Current vs. Expected behavior

Current behavior:

The model generates output like this, looping indefinitely:

THOUGHT: I need to write a simple JavaScript function...

```javascript
function helloWorld() {
  console.log("Hello World");
}
helloWorld();
```<|eot_id|>
THOUGHT: I need to write a simple JavaScript function...

```javascript
function helloWorld() {
  console.log("Hello World");
}
helloWorld();
```<|eot_id|>
THOUGHT: I need to write a simple JavaScript function...
[continues forever]

Note the literal <|eot_id|> tokens appearing in the output. This is the model's stop token - it should trigger termination, not appear as visible text.

Expected behavior:

The model should generate a single response and stop. The <|eot_id|> token should trigger Ollama to stop generation, not appear literally in the output.

Evidence that this is a Zed issue, not an Ollama/model issue:

When calling the model directly via Ollama's API, it works correctly:

curl -s http://localhost:11434/api/chat -d '{"model": "rnj-1:8b", "messages": [{"role": "user", "content": "Write a hello world function"}], "stream": false}'

Returns a single, properly-terminated response with "done_reason":"stop". The stop tokens are correctly configured in the model's Modelfile:

PARAMETER stop <|start_header_id|>
PARAMETER stop <|end_header_id|>
PARAMETER stop <|eot_id|>

Other Ollama models (e.g., gpt-oss-20b) work correctly in Zed. Only rnj-1 exhibits this behavior, suggesting Zed may be overriding or not passing stop tokens correctly for this model.

Zed version and system specs

Zed: v0.220.6 (6a75953)
OS: Windows
Ollama: 0.15.2

Attach Zed log file

Zed.log

Relevant Zed settings

settings.json

Relevant Keymap

keymap.json

(for AI issues) Model provider details

  • Provider: Ollama (local)
  • Model Name: rnj-1:8b (Essential AI)
  • Mode: Agent Panel and Inline Assistant (both affected)
  • Other details:
    • Model correctly configured with stop tokens in Modelfile
    • Model works correctly when called directly via Ollama API (curl)
    • Other Ollama models (gpt-oss-20b) work correctly in Zed
    • Only rnj-1 exhibits this infinite generation behavior

If you are using WSL on Windows, what flavor of Linux are you using?

None

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:ai/agent threadarea:ai/ollamaIssues when using models through Ollama.frequency:commonBugs that happen for at least a third of the users across all platforms and kinds of usagepriority:P2Average run-of-the-mill bugsstate:needs reproNeeds reproduction steps and/or someone to reproduce

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions