ollama - 💡(How to fix) Fix /set think false incorrectly sends string "false" instead of boolean false, causing 400 Bad Request [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
ollama/ollama#14687Fetched 2026-04-08 00:32:55
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
0
Author
Participants
Timeline (top)
closed ×1labeled ×1

Error Message

When using /set think false in the interactive CLI, the value is passed to the API as the string "false" instead of the boolean false. This causes a 400 Bad Request error since the API only accepts boolean true/false or string values "high", "medium", "low". error: 400 Bad Request: invalid think value: "false" (must be "high", "medium", "low", true, or false)

RAW_BUFFERClick to expand / collapse

What is the issue?

Body: Describe the bug When using /set think false in the interactive CLI, the value is passed to the API as the string "false" instead of the boolean false. This causes a 400 Bad Request error since the API only accepts boolean true/false or string values "high", "medium", "low". Steps to Reproduce

Run ollama run <model> (e.g. a model that supports thinking, like deepseek-r1) In the interactive prompt, type /set think false Send any message

Expected Behavior The think parameter should be sent as boolean false, and the request should succeed. Actual Behavior Set 'think' mode to 'false'. error: 400 Bad Request: invalid think value: "false" (must be "high", "medium", "low", true, or false) The CLI converts the boolean input false into the string "false", which fails API validation. Environment

OS: win11 Ollama version: 0.17.7 Model: qwen3.5:0.8b

Relevant log output

OS

No response

GPU

No response

CPU

No response

Ollama version

No response

extent analysis

Fix Plan

The fix involves modifying the CLI to pass the think parameter as a boolean value instead of a string.

  • Update the interactive CLI to parse the /set think command and convert the input to a boolean value.
  • Modify the API request to send the think parameter as a boolean.

Example code snippet:

import json

# ...

def set_think(value):
    if value.lower() == "false":
        return False
    elif value.lower() == "true":
        return True
    else:
        raise ValueError("Invalid think value")

# ...

think_value = set_think(input_value)
api_request = {"think": think_value}
response = requests.post(api_url, json=api_request)

Alternatively, you can use a dictionary to map string inputs to boolean values:

think_map = {"false": False, "true": True}

def set_think(value):
    return think_map.get(value.lower())

# ...

think_value = set_think(input_value)
api_request = {"think": think_value}
response = requests.post(api_url, json=api_request)

Verification

To verify the fix, run the interactive CLI and type /set think false. Send a message and check that the API request succeeds without returning a 400 Bad Request error.

Extra Tips

  • Make sure to handle invalid input values and raise an error if the input is not a valid boolean or string value.
  • Consider adding input validation to ensure that only valid values are accepted.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

ollama - 💡(How to fix) Fix /set think false incorrectly sends string "false" instead of boolean false, causing 400 Bad Request [1 participants]