fix: handle list-type host in settings and fix [object Object] error display#908
Open
fqx wants to merge 2 commits intojundot:mainfrom
Open
fix: handle list-type host in settings and fix [object Object] error display#908fqx wants to merge 2 commits intojundot:mainfrom
fqx wants to merge 2 commits intojundot:mainfrom
Conversation
…display When users manually set `host` to a YAML list in settings.yaml, the backend would store the list object in ServerSettings.host (typed str), causing the web UI to receive a non-string value. Alpine.js x-model then displayed "[object Object]" in the host input, and saving triggered a Pydantic 422 whose array-of-objects detail was joined to "[object Object]". - settings.py: normalize host to string in from_dict() — list values are joined with ", " so the web UI can display and edit them normally - dashboard.js: extract .msg from Pydantic error detail objects instead of calling .join() directly on them, preventing "[object Object]" in all error toasts (fixes two call sites) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Users can now enter multiple bind addresses in the host field separated by commas (e.g. "127.0.0.1, 0.0.0.0"). The existing YAML list format is also handled via the from_dict() normalization added in the previous commit. Changes: - cli.py: split host string by comma before calling uvicorn.run(); print one URL line per address; asyncio.create_server() binds a socket for each host in the list natively - utils/network.py: add is_valid_bind_host() which accepts all valid IPs (including 0.0.0.0 and ::) and hostnames — unlike is_valid_alias() which rejects unspecified addresses - admin/routes.py: validate each comma-separated part of the host field on save so invalid values are rejected with a 400 before they can cause a crash on server restart Backward-compatible: single-address strings and legacy YAML list values both continue to work without any settings migration. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Problem
Two related issues with the
hostsetting:[object Object]when editing settings after manually settinghostto a YAML list.ServerSettings.from_dict()assigned the list directly tohost: strwithout type checking.The web UI received a non-string value, Alpine.js
x-modeldisplayed[object Object],and saving triggered a Pydantic 422 whose error-object array was joined to
[object Object].No way to bind to multiple addresses from the web UI.
The host field only accepted a single address. Users had to manually edit
settings.yamlto use a list, which then broke the web UI (issue 1 above).
Fix
omlx/settings.py— normalizehostto a string infrom_dict(). YAML list valuesare joined with
", "so the web UI can display and edit them as a plain string.Backward-compatible: existing single-string configs are unchanged.
omlx/admin/static/js/dashboard.js— extract.msgfrom Pydantic error detail objectsinstead of joining the raw objects. Fixes two call sites so errors show readable text
instead of
[object Object].omlx/cli.py— split the host string by comma before callinguvicorn.run().asyncio.create_server()(used internally by uvicorn) natively accepts a sequence ofhosts and binds a socket for each. The startup message prints one URL per address.
omlx/utils/network.py— addis_valid_bind_host(): accepts all valid IPs including0.0.0.0and::(unlikeis_valid_alias()which rejects unspecified addresses, sincethose are not routable as client-facing URLs but are legitimate bind targets).
omlx/admin/routes.py— validate each comma-separated part of the host field on save,returning a 400 with a readable message before an invalid value can cause a crash on restart.
Usage
Enter multiple bind addresses separated by commas in the Host field:
Existing single-address settings and legacy YAML list values both continue to work without migration.
Testing
127.0.0.1, ::1in the web UI and save — both addresses should appear in startup outputhost: [127.0.0.1]) and restart — web UI should show127.0.0.1not a host!!) — should get a readable 400 error, not[object Object]🤖 Generated with Claude Code