Skip to content

Get up and running with Kimi, GLM, MiniMax, DeepSeek, gpt-oss, Qwen, Gemma and other models.

fix error on `ollama run` with a non-existent model

Jeffrey Morgan09a6f76f4c30
diff --git a/cmd/cmd.go b/cmd/cmd.go
index c393a9e2d..66909c2cc 100644
--- a/cmd/cmd.go
+++ b/cmd/cmd.go
@@ -147,6 +147,7 @@ func RunHandler(cmd *cobra.Command, args []string) error {
}
name := args[0]
+
// check if the model exists on the server
show, err := client.Show(cmd.Context(), &api.ShowRequest{Name: name})
var statusError api.StatusError
@@ -155,6 +156,11 @@ func RunHandler(cmd *cobra.Command, args []string) error {
if err := PullHandler(cmd, []string{name}); err != nil {
return err
}
+
+ show, err = client.Show(cmd.Context(), &api.ShowRequest{Name: name})
+ if err != nil {
+ return err
+ }
case err != nil:
return err
}