From 3486ce1c0398f46a539142daa0f38721200b911d Mon Sep 17 00:00:00 2001 From: Engineer Date: Mon, 20 Jul 2026 02:53:15 +0200 Subject: [PATCH 1/2] fix(config): wrap malformed config error with file path and remove panic - Wrap the JSON parse error in LoadConfig with the config file path so users know which file has the problem (fixes #1520). - Replace panic on malformed embedded default_keybinds.json with a logged warning that returns empty keybinds, preventing a crash from corrupted embedded data. --- config/config.go | 2 +- config/keybinds.go | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/config/config.go b/config/config.go index 9636c38d..24288670 100644 --- a/config/config.go +++ b/config/config.go @@ -663,7 +663,7 @@ func LoadConfig() (*Config, error) { } return &config, nil } - return nil, err + return nil, fmt.Errorf("could not parse config file %s: %w", path, err) } config.DisableImages = raw.DisableImages diff --git a/config/keybinds.go b/config/keybinds.go index f7856522..727bf777 100644 --- a/config/keybinds.go +++ b/config/keybinds.go @@ -3,6 +3,7 @@ package config import ( _ "embed" "encoding/json" + "log" keybind "github.com/floatpane/go-keybind" ) @@ -87,7 +88,9 @@ type DraftsKeys struct { func defaultKeybinds() KeybindsConfig { var kb KeybindsConfig if err := json.Unmarshal(defaultKeybindsJSON, &kb); err != nil { - panic("matcha: malformed default_keybinds.json: " + err.Error()) + // This should never happen — the embedded JSON is compiled into the + // binary. If it does, return empty keybinds rather than panicking. + log.Printf("matcha: malformed default_keybinds.json (using empty keybinds): %v", err) } return kb } From 90334b37eaaa4e91f4ad4689427a84dc047e65cb Mon Sep 17 00:00:00 2001 From: kawacukennedy Date: Mon, 20 Jul 2026 09:43:53 +0200 Subject: [PATCH 2/2] ci: retrigger CI