#Ollama Not Working - Session Locked Out

1 messages ยท Page 1 of 1 (latest)

obsidian harbor
#

I have the following configuration:

{
  "agents": {
    "defaults": {
      "maxConcurrent": 4,
      "subagents": {
        "maxConcurrent": 8
      },
      "compaction": {
        "mode": "safeguard"
      },
      "workspace": "/home/node/clawd",
      "model": {
        "primary": "ollama/mistral-large-3:675b-cloud"
      }
    }
  },
  "models": {
    "providers": {
      "ollama": {
        "baseUrl": "http://redacted.com:8081/api",
        "apiKey": "REDACTED",
        "api": "ollama", // I have also tried openai and openai-completions here
        "models": [
          { "id": "devstral-2:123b-cloud", "name": "Devstral 2", "reasoning": true },
          { "id": "mistral-large-3:675b-cloud", "name": "Mistral Large 3", "reasoning": true },
          { "id": "deepseek-v3.2:cloud", "name": "DeepSeek 3.2", "reasoning": true }
        ]
      }
    }
  }
}

If I use "ollama" for the "api" configuration parameter, I get an error on startup. If I use openai-completions, I get a 404 error when I send a message to my bot. If I use openai, I get no error or log on the ollama side, and no response from the bot. It then locks me out of my session

clawdbot-gateway-1  | 2026-01-26T16:07:56.871Z [diagnostic] lane task error: lane=main durationMs=10543 error="Error: session file locked (timeout 10000ms): pid=7 /home/node/.clawdbot/agents/main/sessions/a149e1b3-d694-455b-8390-b77061161c16.jsonl.lock"
grand viperBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> โœ… Mark Solution

jovial urchinBOT
# obsidian harbor I have the following configuration: ``` { "agents": { "defaults": { ...

Now I understand the issue. Let me provide the solution:

The problem: The Ollama configuration has two critical issues:

  1. Missing /v1 in baseUrl - Ollama's OpenAI-compatible API requires the /v1 endpoint
  2. Wrong api setting - api: "ollama" doesn't exist; use implicit discovery or explicit with openai-completions

Fix your config to:

{
  models: {
    providers: {
      ollama: {
        // Must include /v1 for OpenAI-compatible API
        baseUrl: "http://redacted.com:8081/v1",
#
        apiKey: "ollama-local",  // Any value works for Ollama
        api: "openai-completions",
        models: [
          { 
            "id": "mistral-large-3:675b-cloud",  // Use exact Ollama model name
            "name": "Mistral Large 3",
            "reasoning": true 
          },
          { 
            "id": "deepseek-v3.2:cloud",
            "name": "DeepSeek 3.2",
            "reasoning": true 
          }
        ]
      }
#
    }
  },
  agents: {
    defaults: {
      model: {
        primary: "ollama/mistral-large-3:675b-cloud"
      }
    }
  }
}

Or even simpler - use implicit discovery:

If your remote Ollama is accessible, just set environment variable and omit explicit config:

#
export OLLAMA_API_KEY="ollama-local"
# Don't define models.providers.ollama at all

Clawdbot will auto-discover models from http://redacted.com:8081 (adds /v1 and /api/tags internally).

Key points:

  • baseUrl MUST end with /v1 for explicit config
  • Use api: "openai-completions" (not "ollama" or "openai")
  • Model IDs must match exactly what ollama list shows
  • Port 8081 is fine, just needs the /v1 suffix
obsidian harbor
#

Now I get an HTTP 500 reply from the bot with no errors in my ollama logs

jovial urchinBOT
# obsidian harbor Now I get an HTTP 500 reply from the bot with no errors in my ollama logs

HTTP 500 with no Ollama logs means the request is reaching Ollama but failing. Let's debug:

First, test your Ollama API directly:

# List models on remote server
curl http://redacted.com:8081/api/tags

# Try a simple completion test
curl http://redacted.com:8081/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "mistral-large-3:675b-cloud",
    "messages": [{"role": "user", "content": "hi"}],
    "max_tokens": 50
  }'
#

Common issues:

  1. Model name format - Remote Ollama might need a different name format. What does curl /api/tags return?

  2. Model not pulled - Is mistral-large-3:675b-cloud actually available on that remote Ollama instance?

  3. Try without :cloud suffix - Some remote Ollama setups use just the model name:

    "model": "mistral-large-3"
    
  4. Check Ollama server logs on the remote host - HTTP 500 should appear there.

Quick config to test - simplify the model ID:

#
{
  models: {
    providers: {
      ollama: {
        baseUrl: "http://redacted.com:8081/v1",
        apiKey: "ollama-local",
        api: "openai-completions",
        models: [
          { 
            "id": "mistral-large-3",  // Try without :675b-cloud
            "name": "Mistral Large 3",
            "reasoning": true 
          }
        ]
      }
#
    }
  }
}

What does curl http://redacted.com:8081/api/tags return on the remote Ollama?

obsidian harbor
#

It returns JSON with a list of my local models. I also tried the "simple completion test" and it worked successfully - I got JSON with a valid response back

#

If I try omitting the :suffix I get "model 'mistral-large-3' not found" as an error from the bot

jovial urchinBOT
# obsidian harbor It returns JSON with a list of my local models. I also tried the "simple complet...

The API works fine, so the 500 is coming from Clawdbot, not Ollama. Check your gateway logs for the actual error:

# Get full gateway logs with the 500 error
clawdbot gateway logs --tail=100 | grep -i "500\|error\|mistral"

Also check: The session lock error from earlier might be corrupting things. Try:

# Clear stuck locks
rm -f ~/.clawdbot/agents/main/sessions/*.lock

# Restart gateway
clawdbot gateway restart
#
# Then test again

Most likely causes:

  1. Context window issue - Add explicit context settings:
    {
      "models": {
        "providers": {
          "ollama": {
            "models": [
              {
                "id": "mistral-large-3:675b-cloud",
                "name": "Mistral Large 3",
    
#
               "reasoning": true,
               "contextWindow": 131072,
               "maxTokens": 131072
             }
           ]
         }
       }
     }
   }
  1. Cost settings - Explicit costs can help:
    "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 }
    
#

What does clawdbot gateway logs show when you send a message?

obsidian harbor
#

How do I execute that using docker compose?

#

Context window and cost settings made no difference, still getting a 500

jovial urchinBOT
# obsidian harbor How do I execute that using docker compose?
# View gateway logs
docker compose logs clawdbot-gateway -tail=100

# Or follow logs in real-time
docker compose logs -f clawdbot-gateway

# Clear locks inside the container
docker compose exec clawdbot-gateway rm -f /home/node/.clawdbot/agents/main/sessions/*.lock

# Restart the gateway service
docker compose restart clawdbot-gateway

Quick one-liner to see errors:

jovial urchinBOT
#
docker compose logs clawdbot-gateway 2>&1 | grep -i "error\|500\|mistral\|failed"