Skip to content

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

server: target invalid

Michael Yang45b6a12e4551
diff --git a/cmd/cmd.go b/cmd/cmd.go
index 2315ad1af..eb6ae76f7 100644
--- a/cmd/cmd.go
+++ b/cmd/cmd.go
@@ -1125,7 +1125,7 @@ Environment Variables:
RunE: ListHandler,
}
copyCmd := &cobra.Command{
- Use: "cp SOURCE TARGET",
+ Use: "cp SOURCE DESTINATION",
Short: "Copy a model",
Args: cobra.ExactArgs(2),
PreRunE: checkServerHeartbeat,
diff --git a/server/routes.go b/server/routes.go
index b1962d23a..917bb2efb 100644
--- a/server/routes.go
+++ b/server/routes.go
@@ -810,16 +810,13 @@ func (s *Server) CopyModelHandler(c *gin.Context) {
src := model.ParseName(r.Source)
if !src.IsValid() {
- _ = c.Error(fmt.Errorf("source %q is invalid", r.Source))
+ c.AbortWithStatusJSON(http.StatusBadRequest, gin.H{"error": fmt.Sprintf("source %q is invalid", r.Source)})
+ return
}
dst := model.ParseName(r.Destination)
if !dst.IsValid() {
- _ = c.Error(fmt.Errorf("destination %q is invalid", r.Destination))
- }
-
- if len(c.Errors) > 0 {
- c.AbortWithStatusJSON(http.StatusBadRequest, gin.H{"error": c.Errors.Errors()})
+ c.AbortWithStatusJSON(http.StatusBadRequest, gin.H{"error": fmt.Sprintf("destination %q is invalid", r.Source)})
return
}