{"record":{"id":"b2688d3e1fe5a7a3","repo":"LGUG2Z/komorebi","slug":"unsupported-format","errorCode":null,"errorMessage":"unsupported format","messagePattern":"unsupported format","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"komorebi-bar/src/config.rs","lineNumber":512,"sourceCode":"            MouseMessage::Command(cmd) => {\n                tracing::debug!(\"Executing command: {}\", cmd);\n\n                let cmd_no_env = cmd.replace_env();\n\n                if exec_powershell(cmd_no_env.to_str().expect(\"Invalid command\")).is_err() {\n                    tracing::error!(\"Failed to execute '{}'\", cmd);\n                }\n            }\n        };\n    }\n}\n\nimpl KomobarConfig {\n    pub fn read(path: &PathBuf) -> color_eyre::Result<Self> {\n        let content = std::fs::read_to_string(path)?;\n        let mut value: Self = match path.extension().unwrap().to_string_lossy().as_str() {\n            \"json\" => serde_json::from_str(&content)?,\n            _ => panic!(\"unsupported format\"),\n        };\n\n        if value.frame.is_none() {\n            value.frame = Some(FrameConfig {\n                inner_margin: Position {\n                    x: DEFAULT_PADDING,\n                    y: DEFAULT_PADDING,\n                },\n            });\n        }\n\n        Ok(value)\n    }\n}\n\n#[derive(Copy, Clone, Debug, Serialize, Deserialize)]\n#[cfg_attr(feature = \"schemars\", derive(schemars::JsonSchema))]\n/// Position","sourceCodeStart":494,"sourceCodeEnd":530,"githubUrl":"https://github.com/LGUG2Z/komorebi/blob/e0709f02bfae4e503bf4640f58ee75ecbbfdbb97/komorebi-bar/src/config.rs#L494-L530","documentation":"KomobarConfig::read loads a komobar configuration file and only supports JSON. If the file's extension is anything other than \"json\", the match falls through to an explicit panic!(\"unsupported format\"). YAML/other formats are simply not implemented for komobar config.","triggerScenarios":"Calling KomobarConfig::read with a path whose extension is not \"json\" (e.g. komobar.yml, komobar.yaml, komobar.toml, or no extension). Also note the unwrap on path.extension(): a path with no extension panics before this message ever fires.","commonSituations":"Users copying the YAML config style used elsewhere in komorebi (komorebi.json/.yaml support) and creating komobar.yaml; typos in the config filename; renaming the file without the .json extension.","solutions":["Rename the komobar config file so it ends in .json (komobar.json).","If the file is YAML, convert it to JSON (e.g. yq -o=json komobar.yaml > komobar.json).","Ensure the path passed to KomobarConfig::read points at the .json file, and has an extension at all."],"exampleFix":"// before\nkomorebi.panic? -> $Env:KOMOBAR_CONFIG_HOME = \"C:\\Users\\me\\.config\\komobar.yaml\"\n// after\n$Env:KOMOBAR_CONFIG_HOME = \"C:\\Users\\me\\.config\\komobar.json\"","handlingStrategy":"validation","validationCode":"let path = PathBuf::from(config_path);\nassert_eq!(path.extension().map(|e| e.to_string_lossy().to_lowercase()).as_deref(), Some(\"json\"), \"komobar config must be a .json file\");","typeGuard":"fn is_json_config(path: &std::path::Path) -> bool {\n    path.extension().map(|e| e.eq_ignore_ascii_case(\"json\")).unwrap_or(false)\n}","tryCatchPattern":"match std::panic::catch_unwind(|| KomobarConfig::read(&path)) {\n    Ok(cfg) => cfg,\n    Err(_) => eprintln!(\"config must be .json; got {}\", path.display()),\n}","preventionTips":["Always name the komobar config komobar.json","Convert YAML configs to JSON before use","Never pass paths without a .json extension to KomobarConfig::read"],"tags":["config","unsupported-format","panic"],"backgroundTag":"unsupported-config-value","analyzedSha":"e0709f02bfae4e503bf4640f58ee75ecbbfdbb97","analyzedAt":"2026-09-06T07:08:05.107Z","contentChangedAt":"2026-09-06T07:08:05.107Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}