[GH-ISSUE #7551] Error saving current context #4806

Closed
opened 2026-04-12 15:46:57 -05:00 by GiteaMirror · 5 comments
Owner

Originally created by @belfie13 on GitHub (Nov 7, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/7551

Originally assigned to: @pdevine on GitHub.

What is the issue?

EDIT: can reproduce an error by saving after a message that begins with ".

>>> /save mymodel
Error: command must be one of "from", "license", "template", "system", "adapter", "parameter", or "message"

this is after a long chat session with a previously saved model.
this is likely from the /save command not converting the session to the correct format for a saved model file.
I found that enclosing each message with """ newline message newline """ is the easiest way to avoid characters in the message from exiting the string context during parsing.
I can't tell without being able to view the data generated from the save command
I was able to reproduce another error

>>> "open quote
>>> /save stc
Error: unexpected EOF

also happens after a response

>>> "open quote
It appears that you've started quoting from somewhere, but^C

>>> /save stc
Error: unexpected EOF

my guess again is that the user message is not quoted during a save which means if it contains only one " the parser thinks it's a string and can't process.

could be solved by escaping quotes in all messages before saving?

note: works when " is not the first character of a message.

>>> \"open quote
>>> /save stc
Created new model 'stc'
>>> x"open quote
>>> /save stc
Created new model 'stc'

OS

macOS

GPU

AMD

CPU

Intel

Ollama version

0.4.0

Originally created by @belfie13 on GitHub (Nov 7, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/7551 Originally assigned to: @pdevine on GitHub. ### What is the issue? EDIT: can reproduce an error by saving after a message that begins with `"`. ``` >>> /save mymodel Error: command must be one of "from", "license", "template", "system", "adapter", "parameter", or "message" ``` this is after a long chat session with a previously saved model. this is likely from the `/save` command not converting the session to the correct format for a saved model file. I found that enclosing each message with `"""` newline message newline `"""` is the easiest way to avoid characters in the message from exiting the string context during parsing. I can't tell without being able to view the data generated from the save command I was able to reproduce another error ``` >>> "open quote >>> /save stc Error: unexpected EOF ``` also happens after a response ``` >>> "open quote It appears that you've started quoting from somewhere, but^C >>> /save stc Error: unexpected EOF ``` my guess again is that the user message is not quoted during a save which means if it contains only one `"` the parser thinks it's a string and can't process. could be solved by escaping quotes in all messages before saving? note: works when `"` is not the first character of a message. ``` >>> \"open quote >>> /save stc Created new model 'stc' >>> x"open quote >>> /save stc Created new model 'stc' ``` ### OS macOS ### GPU AMD ### CPU Intel ### Ollama version 0.4.0
GiteaMirror added the bug label 2026-04-12 15:46:57 -05:00
Author
Owner

@axemaster commented on GitHub (Dec 16, 2024):

What is the issue?

EDIT: can reproduce an error by saving after a message that begins with ".

>>> /save mymodel
Error: command must be one of "from", "license", "template", "system", "adapter", "parameter", or "message"

this is after a long chat session with a previously saved model. this is likely from the /save command not converting the session to the correct format for a saved model file. I found that enclosing each message with """ newline message newline """ is the easiest way to avoid characters in the message from exiting the string context during parsing. I can't tell without being able to view the data generated from the save command I was able to reproduce another error

>>> "open quote
>>> /save stc
Error: unexpected EOF

also happens after a response

>>> "open quote
It appears that you've started quoting from somewhere, but^C

>>> /save stc
Error: unexpected EOF

my guess again is that the user message is not quoted during a save which means if it contains only one " the parser thinks it's a string and can't process.

could be solved by escaping quotes in all messages before saving?

note: works when " is not the first character of a message.

>>> \"open quote
>>> /save stc
Created new model 'stc'
>>> x"open quote
>>> /save stc
Created new model 'stc'

OS

macOS

GPU

AMD

CPU

Intel

Ollama version

0.4.0

I have gotten "unexpected EOF" and then abrupt exit of the ollama interactive process three times in the last two days when doing /save {name}. I don't often want to save the context so this is 50% failure rate.

Mac M1 & M2. #NeuralDaredevil model. (3.0GB)

No errors in server.log. I didn't check it right after the last crash so I'll be sure to do so the next time. I don't think the request made it to the back end however.

<!-- gh-comment-id:2544772758 --> @axemaster commented on GitHub (Dec 16, 2024): > ### What is the issue? > EDIT: can reproduce an error by saving after a message that begins with `"`. > > ``` > >>> /save mymodel > Error: command must be one of "from", "license", "template", "system", "adapter", "parameter", or "message" > ``` > > this is after a long chat session with a previously saved model. this is likely from the `/save` command not converting the session to the correct format for a saved model file. I found that enclosing each message with `"""` newline message newline `"""` is the easiest way to avoid characters in the message from exiting the string context during parsing. I can't tell without being able to view the data generated from the save command I was able to reproduce another error > > ``` > >>> "open quote > >>> /save stc > Error: unexpected EOF > ``` > > also happens after a response > > ``` > >>> "open quote > It appears that you've started quoting from somewhere, but^C > > >>> /save stc > Error: unexpected EOF > ``` > > my guess again is that the user message is not quoted during a save which means if it contains only one `"` the parser thinks it's a string and can't process. > > could be solved by escaping quotes in all messages before saving? > > note: works when `"` is not the first character of a message. > > ``` > >>> \"open quote > >>> /save stc > Created new model 'stc' > >>> x"open quote > >>> /save stc > Created new model 'stc' > ``` > > ### OS > macOS > > ### GPU > AMD > > ### CPU > Intel > > ### Ollama version > 0.4.0 I have gotten "unexpected EOF" and then abrupt exit of the ollama interactive process three times in the last two days when doing /save {name}. I don't often want to save the context so this is 50% failure rate. Mac M1 & M2. #NeuralDaredevil model. (3.0GB) No errors in server.log. I didn't check it right after the last crash so I'll be sure to do so the next time. I don't think the request made it to the back end however.
Author
Owner

@Maltz42 commented on GitHub (Jan 10, 2025):

This may be unrelated to the crash, but you also lose all your pre-existing message history (loaded from prior sessions) and custom parameters,etc when you /save a session. Glad to see this crash fixed, though! Both of those problems have been around since 0.3.2

<!-- gh-comment-id:2584712553 --> @Maltz42 commented on GitHub (Jan 10, 2025): This may be unrelated to the crash, but you also lose all your pre-existing message history (loaded from prior sessions) and custom parameters,etc when you /save a session. Glad to see this crash fixed, though! Both of those problems have been around since 0.3.2
Author
Owner

@belfie13 commented on GitHub (Jan 12, 2025):

the custom parameters saved but /show parameters didn't show repeat_last_n which was set previously in the modelfile @Maltz42

<!-- gh-comment-id:2585772808 --> @belfie13 commented on GitHub (Jan 12, 2025): the custom parameters saved but `/show parameters` didn't show `repeat_last_n` which was set previously in the modelfile @Maltz42
Author
Owner

@belfie13 commented on GitHub (Jan 12, 2025):

happened agian with temperature

>>> /show parameters
Model defined parameters:
num_ctx                        8192
stop                           "<|start_header_id|>"
stop                           "<|end_header_id|>"
stop                           "<|eot_id|>"
temperature                    0.99
>>> so what's goin on
>>> /save test
Created new model 'test'
>>> /load test
Loading model 'test'
>>> /show parameters
Model defined parameters:
num_ctx                        8192
stop                           "<|start_header_id|>"
stop                           "<|end_header_id|>"
stop                           "<|eot_id|>"
<!-- gh-comment-id:2585774005 --> @belfie13 commented on GitHub (Jan 12, 2025): happened agian with `temperature` ``` >>> /show parameters Model defined parameters: num_ctx 8192 stop "<|start_header_id|>" stop "<|end_header_id|>" stop "<|eot_id|>" temperature 0.99 >>> so what's goin on >>> /save test Created new model 'test' >>> /load test Loading model 'test' >>> /show parameters Model defined parameters: num_ctx 8192 stop "<|start_header_id|>" stop "<|end_header_id|>" stop "<|eot_id|>" ```
Author
Owner

@Maltz42 commented on GitHub (Jan 12, 2025):

Yeah, it appears /save now only saves what happens in the current, active session, and no longer saves parameters or messages from the modelfile. This change happened in 0.3.2, but I doubt it was intentional. There's actually an open issue already, #6222 but I thought I'd bump the issue here as well, since someone appeared to be interested in fixing /save :)

<!-- gh-comment-id:2585839821 --> @Maltz42 commented on GitHub (Jan 12, 2025): Yeah, it appears /save now only saves what happens in the current, active session, and no longer saves parameters or messages from the modelfile. This change happened in 0.3.2, but I doubt it was intentional. There's actually an open issue already, #6222 but I thought I'd bump the issue here as well, since someone appeared to be interested in fixing /save :)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#4806