[GH-ISSUE #2751] Error on run ollama serve on windows 10 #1656

Closed
opened 2026-04-12 11:37:04 -05:00 by GiteaMirror · 4 comments
Owner

Originally created by @Alias4D on GitHub (Feb 25, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/2751

Error on run ollama serve

time=2024-02-26T00:41:24.616+03:00 level=INFO source=images.go:706 msg="total blobs: 0"
time=2024-02-26T00:41:24.627+03:00 level=INFO source=images.go:713 msg="total unused blobs removed: 0"
panic: bad origin: origins must contain '*' or include http://,https://,chrome-extension://,safari-extension://,moz-extension://,ms-browser-extension://

goroutine 1 [running]:
github.com/gin-contrib/cors.newCors({0x0, {0xc0000a4000, 0xd, 0x14}, 0x0, {0xc0003fa150, 0x7, 0x7}, {0xc0003e8360, 0x3, ...}, ...})
C:/Users/jeff/go/pkg/mod/github.com/gin-contrib/cors@v1.4.0/config.go:42 +0x2b4
github.com/gin-contrib/cors.New({0x0, {0xc0000a4000, 0xd, 0x14}, 0x0, {0xc0003fa150, 0x7, 0x7}, {0xc0003e8360, 0x3, ...}, ...})
C:/Users/jeff/go/pkg/mod/github.com/gin-contrib/cors@v1.4.0/cors.go:164 +0x58
github.com/jmorganca/ollama/server.(*Server).GenerateRoutes(0xc0003a4020)
C:/Users/jeff/git/ollama/server/routes.go:935 +0x585
github.com/jmorganca/ollama/server.Serve({0x7ff71a4a5cf0, 0xc000067720})
C:/Users/jeff/git/ollama/server/routes.go:1012 +0x233
github.com/jmorganca/ollama/cmd.RunServer(0xc00017cb00?, {0x7ff71a9318a0?, 0x4?, 0x7ff7191b0f6b?})
C:/Users/jeff/git/ollama/cmd/cmd.go:706 +0x1a5
github.com/spf13/cobra.(*Command).execute(0xc000514908, {0x7ff71a9318a0, 0x0, 0x0})
C:/Users/jeff/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:940 +0x882
github.com/spf13/cobra.(*Command).ExecuteC(0xc0001cbb08)
C:/Users/jeff/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:1068 +0x3a5
github.com/spf13/cobra.(*Command).Execute(...)
C:/Users/jeff/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:992
github.com/spf13/cobra.(*Command).ExecuteContext(...)
C:/Users/jeff/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:985
main.main()
C:/Users/jeff/git/ollama/main.go:11 +0x4d

Screenshot 2024-02-26 004421

Originally created by @Alias4D on GitHub (Feb 25, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/2751 **Error on run ollama serve** time=2024-02-26T00:41:24.616+03:00 level=INFO source=images.go:706 msg="total blobs: 0" time=2024-02-26T00:41:24.627+03:00 level=INFO source=images.go:713 msg="total unused blobs removed: 0" panic: bad origin: origins must contain '*' or include http://,https://,chrome-extension://,safari-extension://,moz-extension://,ms-browser-extension:// goroutine 1 [running]: github.com/gin-contrib/cors.newCors({0x0, {0xc0000a4000, 0xd, 0x14}, 0x0, {0xc0003fa150, 0x7, 0x7}, {0xc0003e8360, 0x3, ...}, ...}) C:/Users/jeff/go/pkg/mod/github.com/gin-contrib/cors@v1.4.0/config.go:42 +0x2b4 github.com/gin-contrib/cors.New({0x0, {0xc0000a4000, 0xd, 0x14}, 0x0, {0xc0003fa150, 0x7, 0x7}, {0xc0003e8360, 0x3, ...}, ...}) C:/Users/jeff/go/pkg/mod/github.com/gin-contrib/cors@v1.4.0/cors.go:164 +0x58 github.com/jmorganca/ollama/server.(*Server).GenerateRoutes(0xc0003a4020) C:/Users/jeff/git/ollama/server/routes.go:935 +0x585 github.com/jmorganca/ollama/server.Serve({0x7ff71a4a5cf0, 0xc000067720}) C:/Users/jeff/git/ollama/server/routes.go:1012 +0x233 github.com/jmorganca/ollama/cmd.RunServer(0xc00017cb00?, {0x7ff71a9318a0?, 0x4?, 0x7ff7191b0f6b?}) C:/Users/jeff/git/ollama/cmd/cmd.go:706 +0x1a5 github.com/spf13/cobra.(*Command).execute(0xc000514908, {0x7ff71a9318a0, 0x0, 0x0}) C:/Users/jeff/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:940 +0x882 github.com/spf13/cobra.(*Command).ExecuteC(0xc0001cbb08) C:/Users/jeff/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:1068 +0x3a5 github.com/spf13/cobra.(*Command).Execute(...) C:/Users/jeff/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:992 github.com/spf13/cobra.(*Command).ExecuteContext(...) C:/Users/jeff/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:985 main.main() C:/Users/jeff/git/ollama/main.go:11 +0x4d ![Screenshot 2024-02-26 004421](https://github.com/ollama/ollama/assets/27604791/cd485211-df72-4715-901e-7c8217a749f6)
Author
Owner

@remy415 commented on GitHub (Feb 25, 2024):

Did you set the OLLAMA_ORIGINS environment variable before launching? The error message suggests something invalid was assigned to origins.

<!-- gh-comment-id:1963086653 --> @remy415 commented on GitHub (Feb 25, 2024): Did you set the `OLLAMA_ORIGINS` environment variable before launching? The error message suggests something invalid was assigned to origins.
Author
Owner

@Alias4D commented on GitHub (Feb 26, 2024):

Yes, I need to expose ollama open api over lan network to use it with other open api clients on windows or Android like PandasAi, maid, next gpt chat web ui and ... Others.

I set OLLAMA_ORIGINS with windows environment to 0.0.0.0

Finally, I'm not successfully and get this issue 😔

IF you have any fix for this issue and any help for my problem, please help me 🙏

<!-- gh-comment-id:1964061864 --> @Alias4D commented on GitHub (Feb 26, 2024): Yes, I need to expose ollama open api over lan network to use it with other open api clients on windows or Android like PandasAi, maid, next gpt chat web ui and ... Others. I set OLLAMA_ORIGINS with windows environment to 0.0.0.0 Finally, I'm not successfully and get this issue 😔 IF you have any fix for this issue and any help for my problem, please help me 🙏
Author
Owner

@remy415 commented on GitHub (Feb 26, 2024):

@Alias4D okay that is the incorrect environment variable for that. Set OLLAMA_ORIGINS=“”, then set OLLAMA_HOST=“0.0.0.0”.

OLLAMA_ORIGINS is for controlling cross origin requests. What you have said you are looking for is to expose the API over LAN, which is to say you want the service to listen on external interfaces.

If you are connecting via a chrome extension, that will require adjusting OLLAMA_ORIGINS but that is a complex topic I have little familiarity with.

<!-- gh-comment-id:1964224861 --> @remy415 commented on GitHub (Feb 26, 2024): @Alias4D okay that is the incorrect environment variable for that. Set `OLLAMA_ORIGINS=“”`, then set `OLLAMA_HOST=“0.0.0.0”`. OLLAMA_ORIGINS is for controlling cross origin requests. What you have said you are looking for is to expose the API over LAN, which is to say you want the service to listen on external interfaces. If you are connecting via a chrome extension, that will require adjusting OLLAMA_ORIGINS but that is a complex topic I have little familiarity with.
Author
Owner

@Alias4D commented on GitHub (Feb 26, 2024):

Thanks for reply 🙏🌹
Problem solved 😊

<!-- gh-comment-id:1964239409 --> @Alias4D commented on GitHub (Feb 26, 2024): Thanks for reply 🙏🌹 Problem solved 😊
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#1656