Repository navigation
Fix Models local register 500 INTERNAL_ERROR on Windows - #30
Merged
Merged
Conversation
Ollama create used an unquoted Windows FROM path and decoded CLI output with the locale codec, while list_models assumed a dict. Those failures escaped as opaque INTERNAL_ERROR. Quote POSIX FROM lines, decode UTF-8, accept SDK list payloads, register already-pulled tags, and return LOCAL_MODEL_REGISTER_FAILED with the real reason. Co-authored-by: XYAI Labs <haoboy8@gmail.com>
Co-authored-by: XYAI Labs <haoboy8@gmail.com>
XYAIStudio
marked this pull request as ready for review
September 16, 2026 07:32
7 of 15 tasks
3 of 4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Registering any local model from Models → LocalHardwarePanel returned a generic
INTERNAL_ERROR500. That was a shared register-path bug, not a bad GGUF.Root causes:
ollama createModelfile wroteFROM C:\Users\...\file.ggufwithout quotes. Backslashes/spaces break Ollama on Windows, so every GGUF import failed.text=Truewithoutencoding="utf-8"/errors="replace". On Chinese Windows (GBK) a failedollama createraisedUnicodeDecodeError, which is notOSError, so the API swallowed it asINTERNAL_ERROR.OllamaModelManager.list_models()called.get()on the modern SDKListResponseobject. Probe already caught that (UI still showed “Ollama 已启用”); register did not, so a successful create still 500’d.source=ollamawas treated as “manual”, emptypathfailed validation, UI hid the button).Fixes:
FROMline +cwd= weight parent + UTF-8 CLI decode.ollama.list()dict and pydantic payloads.ollama create.{ok: false, next_step}orLOCAL_MODEL_REGISTER_FAILED(400) with the real reason. Provider reload after a successful save no longer fails the request.Target branch
develop(feature / fix — default)main(requested: bugfix from latestmain; do not merge / do not touch Release)Type of change
Test plan
uv run pytest tests/unit/test_local_register.py tests/unit/test_ollama_create.py tests/unit/api/test_local_models_register.py tests/unit/i18n/test_errors.pymake lint+make typecheckmake all(full suite not run in this environment)Windows desktop verification (Ollama running)
http://127.0.0.1:11434is up. Models page should show Ollama 已启用.ollama createneeded.C:\Users\<you>\Downloads\*.gguf(spaces in the path are fine) → 注册. Should import viaollama createand then appear on the local provider.ollama createstderr, permissions) must show the real reason, not服务器内部错误。Checklist
CHANGELOG.md(if user-facing)Do not merge this PR and do not replace or cut a Release.