Error: (line 5): command must be one of "from", "license", "template", "system", "adapter", "draft", "renderer", "parser", "parameter", "message", "requires", or "capability"
— a line in your Modelfile starts with a word Ollama does not know. Most often it is a model
setting written on its own, such as TEMPERATURE 0.2, which must be written
PARAMETER temperature 0.2.
Every Modelfile line starts with one of the instructions in that list. Settings such as
temperature, num_ctx and stop are not instructions;
they go after PARAMETER. Be careful with the line number: on a file with
Windows (CRLF) line endings, line 3 was reported as line 5.
The error
PS> Get-Content Modelfile
FROM qwen2.5:0.5b
SYSTEM You are a patient maths tutor.
TEMPERATURE 0.2
PS> ollama create tutor3
Error: (line 5): command must be one of "from", "license", "template", "system", "adapter", "draft", "renderer", "parser", "parameter", "message", "requires", or "capability"
exit code: 1
Why it happens
Each Modelfile line is an instruction followed by its arguments. Upper case worked in the
test (FROM, SYSTEM, PARAMETER) although the message
lists the names in lower case, but the word has to be one of the twelve words this version knows. Anything else, a typo such
as FORM, a setting written as if it were an instruction, or a stray word
left from a copy and paste, stops the parse before any model is built.
The list is printed from the parser of the version you run, so copy it from your own error
rather than from a guide; Ollama 0.40.14 names twelve, including draft,
renderer, parser, requires and
capability. The line number
has a trap of its own. The file above has three lines, and the bad one is line 3, yet the
message says line 5. That file was saved by PowerShell with CRLF line endings. The same
three lines saved with LF endings gave the true number:
PS> (same three lines, saved with LF line endings) ollama create tutor4
Error: (line 3): command must be one of "from", "license", "template", "system", "adapter", "draft", "renderer", "parser", "parameter", "message", "requires", or "capability"
So on a Modelfile with CRLF endings, do not trust the line number: in this test line 3 was reported as line 5.
The fix
PS> Get-Content Modelfile
FROM qwen2.5:0.5b
SYSTEM You are a patient maths tutor.
PARAMETER temperature 0.2
PS> ollama create tutor3
gathering model components
...
writing manifest
success
exit code: 0
PS> ollama show tutor3 --parameters
temperature 0.2
PARAMETER in front of the setting is the whole fix; ollama show --parameters confirms the value landed in the model.
The using existing layer lines of the create output are left out here. If the
error names a line you cannot find, open the file in an editor that shows line endings, or
save it with LF endings, and the number will match what you see.
How it was reproduced
Ollama 0.40.14 on Windows 11, against a separate test server started with
ollama serve on 127.0.0.1:15190 with its own models folder and
qwen2.5:0.5b pulled into it. The model names tutor3 and
tutor4 are the test's own. The Modelfile was written with
Set-Content (CRLF endings) and again with LF endings to check the line number;
both failed on the TEMPERATURE line, and the PARAMETER version
built.
Frequently asked
- How do I set temperature in an Ollama Modelfile?
- Write PARAMETER temperature 0.2 on its own line. TEMPERATURE 0.2 alone is not an instruction and fails with 'command must be one of'. The same goes for num_ctx, top_p and stop.
- Why is the line number in the Ollama Modelfile error wrong?
- In the test, on a file with Windows CRLF line endings, line 3 was reported as line 5. Saved with LF endings, the same file reported line 3.
- Which instructions does an Ollama Modelfile accept?
- Ollama 0.40.14 lists from, license, template, system, adapter, draft, renderer, parser, parameter, message, requires and capability. The error message itself prints the list for the version you run.
More decoded errors in the Fixes category. If
ollama create cannot find the Modelfile at all, see
'no Modelfile or
safetensors files found'.