{"record":{"id":"67ee1f986fbb38c9","repo":"tw93/Pake","slug":"pake-json-must-define-at-least-one-window-configuration","errorCode":null,"errorMessage":"pake.json must define at least one window configuration","messagePattern":"pake\\.json must define at least one window configuration","errorType":"exception","errorClass":"tauri::Error","httpStatus":null,"severity":"critical","filePath":"src-tauri/src/app/window.rs","lineNumber":338,"sourceCode":"/// Tray-click / activation-shortcut toggle: hide all if anything is visible,\n/// otherwise show all. Cancels startup reveal when the caller has already done\n/// so; this helper only touches visibility.\npub fn toggle_all_app_windows(app: &AppHandle, init_fullscreen: bool) {\n    if any_app_window_visible(app) {\n        hide_all_app_windows(app);\n    } else {\n        show_all_app_windows(app, init_fullscreen);\n    }\n}\n\nfn build_window_with_label(\n    app: &AppHandle,\n    config: &PakeConfig,\n    tauri_config: &Config,\n    label: &str,\n) -> tauri::Result<WebviewWindow> {\n    let window_config = config.windows.first().ok_or_else(|| {\n        tauri::Error::Io(std::io::Error::new(\n            std::io::ErrorKind::InvalidData,\n            \"pake.json must define at least one window configuration\",\n        ))\n    })?;\n    let url = match window_config.url_type.as_str() {\n        \"web\" => {\n            let parsed = window_config.url.parse().map_err(|err| {\n                tauri::Error::Io(std::io::Error::new(\n                    std::io::ErrorKind::InvalidInput,\n                    format!(\n                        \"Invalid 'web' url '{}' in pake.json: {err}\",\n                        window_config.url\n                    ),\n                ))\n            })?;\n            WebviewUrl::App(parsed)\n        }\n        \"local\" => WebviewUrl::App(PathBuf::from(&window_config.url)),","sourceCodeStart":320,"sourceCodeEnd":356,"githubUrl":"https://github.com/tw93/Pake/blob/c8fe8a3f1a115428e3555c06b3de9b7458aa0d54/src-tauri/src/app/window.rs#L320-L356","documentation":"build_window_with_label requires the embedded pake.json to contain at least one entry in its 'windows' array; if the array is empty the window cannot be built and a tauri::Error wrapping an InvalidData io::Error is returned. Since pake.json is embedded at compile time, this signals a corrupted or truncated build-time config.","triggerScenarios":"Calling set_window or open_additional_window (e.g. a secondary-window request or multi-window Cmd+N) when config.windows is empty because the pake.json embedded by the CLI build had no windows entries.","commonSituations":"A build pipeline generated a pake.json with an empty windows array; a hand-edited or template pake.json missing the windows section; a partially written config captured by include_str! at compile time.","solutions":["Rebuild the app so pake.json embeds a config with at least one windows entry.","Check src-tauri/pake.json (or the CLI-generated .pake/pake.json) and ensure the windows array has one entry with url and url_type.","Verify the CLI step that merges options into pake.json ran and did not emit an empty windows array."],"exampleFix":"// before (src-tauri/pake.json)\n{ \"windows\": [] }\n// after\n{ \"windows\": [{ \"label\": \"pake\", \"url\": \"https://example.com\", \"url_type\": \"web\" }] }","handlingStrategy":"validation","validationCode":"const cfg = JSON.parse(fs.readFileSync('src-tauri/pake.json'));\nif (!Array.isArray(cfg.windows) || cfg.windows.length === 0) throw new Error('pake.json windows must be a non-empty array');","typeGuard":"const hasWindow = (cfg) => Array.isArray(cfg?.windows) && cfg.windows.length > 0;","tryCatchPattern":"match build_window_with_label(...) { Err(e) if e.to_string().contains(\"at least one window\") => eprintln!(\"config missing windows entry: {e}\"), Err(e) => return Err(e), Ok(w) => w }","preventionTips":["Validate pake.json against schema/pake.schema.json before cargo build","Never hand-edit the generated .pake/pake.json; use the CLI","Add a CI check that windows is non-empty after config generation"],"tags":["configuration","tauri","window"],"backgroundTag":"missing-required-config-field","analyzedSha":"c8fe8a3f1a115428e3555c06b3de9b7458aa0d54","analyzedAt":"2026-09-20T12:02:36.283Z","contentChangedAt":"2026-09-20T12:02:36.283Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}