Error: create-time quantization is only supported for safetensors imports; quantize GGUF models before importing is what ollama create --quantize printed when the Modelfile's FROM named a model pulled from the Ollama library, which ollama show reports as already quantized. Without --quantize the same create worked, and the new model kept the Q4_K_M of its source.

Check what you have with ollama show <model>: the quantization line names it (Q4_K_M for qwen2.5:0.5b, Q8_0 for gemma3:270m here). The flag is meant for models you import from safetensors weights, as the message says.

The error

> type Modelfile-q
FROM qwen2.5:0.5b

> ollama create fix12-qwen-q4 -f Modelfile-q --quantize q4_K_M
Error: create-time quantization is only supported for safetensors imports; quantize GGUF models before importing

The command returned exit code 1. The same message came back for gemma3:270m, whose file is Q8_0, so asking it for q4_K_M did not get past it either, and the ollama list taken afterwards had no fix12-gemma-q4:

> type Modelfile-g
FROM gemma3:270m

> ollama create fix12-gemma-q4 -f Modelfile-g --quantize q4_K_M
Error: create-time quantization is only supported for safetensors imports; quantize GGUF models before importing

Why it happens

The message names safetensors imports as the case --quantize at create time is for. Here it refused both sources tried with q4_K_M, two models pulled from the library, which ollama show reports as already quantized:

> ollama show qwen2.5:0.5b
  Model
    architecture        qwen2
    parameters          494.03M
    context length      32768
    embedding length    896
    quantization        Q4_K_M
    template source     go_template
...

Asking for q4_K_M on a model that is already Q4_K_M is the case in the first block: the flag was not needed at all.

The fix

> ollama create fix12-qwen-q4 -f Modelfile-q
gathering model components
using existing layer sha256:c5396e06af294bd101b30dce59131a76d2b773e76950acc870eda801d3ab0515
...
writing manifest
success

> ollama show fix12-qwen-q4
  Model
    architecture        qwen2
    parameters          494.03M
    context length      32768
    embedding length    896
    quantization        Q4_K_M
    template source     go_template
...

Without the flag the create reused the source's layers and the new model reports Q4_K_M, the same as its source. For a different quantization, the message's own advice is to "quantize GGUF models before importing"; that was not run here.

How it was reproduced

Ollama 0.40.16 on Windows 11, with a test server of its own started by ollama serve with OLLAMA_HOST=127.0.0.1:15190 and OLLAMA_MODELS set to a scratch folder, into which qwen2.5:0.5b and gemma3:270m were pulled through that server (the pull requests are in its request log). Commands ran in cmd.exe, sent from PowerShell as cmd /c "<line> 2>&1", with that OLLAMA_HOST set. The model names fix12-qwen-q4 and fix12-gemma-q4 and the files Modelfile-q and Modelfile-g are the test's own. The spinner and terminal control characters of the console output and the trailing spaces of ollama show are left out, and cuts are marked with ...

Frequently asked

Can I requantize an Ollama library model with ollama create --quantize?
It did not work in the test on Ollama 0.40.16: qwen2.5:0.5b (Q4_K_M) and gemma3:270m (Q8_0), both asked for q4_K_M, were refused with create-time quantization is only supported for safetensors imports.
How do I see which quantization an Ollama model uses?
Run ollama show with the model name and read the quantization line under Model, for example Q4_K_M for qwen2.5:0.5b.
How do I fix create-time quantization is only supported for safetensors imports?
Remove --quantize from the ollama create command. In the test, the create from qwen2.5:0.5b then succeeded and the new model reported Q4_K_M, the quantization of its source.

More decoded errors in the Fixes category. For a Modelfile whose FROM names a file Ollama cannot import, see 'unsupported file type'.