[GH-ISSUE #6] Invalid toml configs display wrong error location #3

Closed
opened 2026-05-22 22:04:57 +01:00 by JakeStanger · 3 comments
Owner

Originally created by @ToxicMushroom on GitHub (Nov 19, 2024).
Original GitHub issue: https://github.com/JakeStanger/universal-config-rs/issues/6

Example occurred with my ironbar config after upgrading recently:

2024-11-19T01:57:22.485029Z ERROR ironbar: 318: Failed to load config: TOML parse error at line 1, column 1
  |
1 | anchor_to_edges = true
  | ^^^^^^^^^^^^^^^^^^^^^^
unknown variant `left_to_right`, expected one of `h`, `horizontal`, `v`, `vertical`

Whilst this actually occurs on like 63
direction = "left_to_right"

Originally created by @ToxicMushroom on GitHub (Nov 19, 2024). Original GitHub issue: https://github.com/JakeStanger/universal-config-rs/issues/6 Example occurred with my ironbar config after upgrading recently: ```` 2024-11-19T01:57:22.485029Z ERROR ironbar: 318: Failed to load config: TOML parse error at line 1, column 1 | 1 | anchor_to_edges = true | ^^^^^^^^^^^^^^^^^^^^^^ unknown variant `left_to_right`, expected one of `h`, `horizontal`, `v`, `vertical` ```` Whilst this actually occurs on like 63 `direction = "left_to_right"`
Author
Owner

@JakeStanger commented on GitHub (Nov 19, 2024):

This is possibly a limitation of the toml crate. Are you able to share the full config please?

<!-- gh-comment-id:2486856894 --> @JakeStanger commented on GitHub (Nov 19, 2024): This is possibly a limitation of the `toml` crate. Are you able to share the full config please?
Author
Owner

@ToxicMushroom commented on GitHub (Nov 20, 2024):

anchor_to_edges = true
height = 42
position = "top"
icon_theme = "Papirus-Dark"

[[start]]
type = "workspaces"
all_monitors = false
on_scroll_up = "swaymsg workspace prev_on_output"
on_scroll_down = "swaymsg workspace next_on_output"


[[end]]
type = "script"
cmd = "/home/merlijn/.bin/iron-bluetooth.sh"
mode = "poll"
interval = 5000
on_click_left = "blueman-manager"

[[end]]
type = "music"
player_type = "mpd"
truncate = "end"


[[end]]
type = "sys_info"
format = [
    "  {cpu_percent}% - {temp_c:k10temp-Tccd1}°C |",
    "  ({memory_percent}%) |",
    "󰋊 ({disk_percent:/}%) |",
    "󰓢 {net_down:enp5s0} / {net_up:enp5s0} Mbps |",
]

[end.interval]
memory = 30
cpu = 1
temps = 5
disks = 300
networks = 3

[[end]]
type = "volume"
format = "{icon} {percentage}%"
max_volume = 100

[end.icons]
volume_high = "󰕾"
volume_medium = "󰖀"
volume_low = "󰕿"
muted = "󰝟"

[end.truncate]
mode = "end"
length = 50


[[end]]
type = "clock"

[[end]]
type = "tray"
direction = "left_to_right"

[[end]]
type = "notifications"
show_count = true

[end.icons]
closed_none = "󰍥"
closed_some = "󱥂"
closed_dnd = "󱅯"
open_none = "󰍡"
open_some = "󱥁"
open_dnd = "󱅮"
<!-- gh-comment-id:2487213060 --> @ToxicMushroom commented on GitHub (Nov 20, 2024): ```toml anchor_to_edges = true height = 42 position = "top" icon_theme = "Papirus-Dark" [[start]] type = "workspaces" all_monitors = false on_scroll_up = "swaymsg workspace prev_on_output" on_scroll_down = "swaymsg workspace next_on_output" [[end]] type = "script" cmd = "/home/merlijn/.bin/iron-bluetooth.sh" mode = "poll" interval = 5000 on_click_left = "blueman-manager" [[end]] type = "music" player_type = "mpd" truncate = "end" [[end]] type = "sys_info" format = [ " {cpu_percent}% - {temp_c:k10temp-Tccd1}°C |", " ({memory_percent}%) |", "󰋊 ({disk_percent:/}%) |", "󰓢 {net_down:enp5s0} / {net_up:enp5s0} Mbps |", ] [end.interval] memory = 30 cpu = 1 temps = 5 disks = 300 networks = 3 [[end]] type = "volume" format = "{icon} {percentage}%" max_volume = 100 [end.icons] volume_high = "󰕾" volume_medium = "󰖀" volume_low = "󰕿" muted = "󰝟" [end.truncate] mode = "end" length = 50 [[end]] type = "clock" [[end]] type = "tray" direction = "left_to_right" [[end]] type = "notifications" show_count = true [end.icons] closed_none = "󰍥" closed_some = "󱥂" closed_dnd = "󱅯" open_none = "󰍡" open_some = "󱥁" open_dnd = "󱅮" ```
Author
Owner

@JakeStanger commented on GitHub (Apr 14, 2025):

Sorry for the delay. I've just had a look into this.

The erroneous span is coming directly from the TOML crate, so there's nothing I can do about it. My best guess is it's related to Ironbar's use of flatten and this issue https://github.com/toml-rs/toml/issues/589

<!-- gh-comment-id:2802818585 --> @JakeStanger commented on GitHub (Apr 14, 2025): Sorry for the delay. I've just had a look into this. The erroneous span is coming directly from the TOML crate, so there's nothing I can do about it. My best guess is it's related to Ironbar's use of `flatten` and this issue https://github.com/toml-rs/toml/issues/589
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
JakeStanger/universal-config-rs#3
No description provided.