tw93/Pake · critical · tauri::Error
pake.json must define at least one window configuration
Error message
pake.json must define at least one window configuration
What it means
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.
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.
Example fix
// before (src-tauri/pake.json)
{ "windows": [] }
// after
{ "windows": [{ "label": "pake", "url": "https://example.com", "url_type": "web" }] } Defensive patterns
Strategy: validation
Validate before calling
const cfg = JSON.parse(fs.readFileSync('src-tauri/pake.json'));
if (!Array.isArray(cfg.windows) || cfg.windows.length === 0) throw new Error('pake.json windows must be a non-empty array'); Type guard
const hasWindow = (cfg) => Array.isArray(cfg?.windows) && cfg.windows.length > 0;
Try / catch
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 } Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.
Related errors
- Failed to parse tauri config
- Invalid 'web' url ' ' in pake.json
- url_type must be 'web' or 'local', got
- about:blank must be a valid URL
- Failed to parse pake config
AI-assisted analysis of tw93/Pake@c8fe8a3f1a (2026-09-20).
Data as JSON: /api/errors/67ee1f986fbb38c9.
Report an issue: GitHub.
Appendix: source
Thrown at src-tauri/src/app/window.rs:338
/// Tray-click / activation-shortcut toggle: hide all if anything is visible,
/// otherwise show all. Cancels startup reveal when the caller has already done
/// so; this helper only touches visibility.
pub fn toggle_all_app_windows(app: &AppHandle, init_fullscreen: bool) {
if any_app_window_visible(app) {
hide_all_app_windows(app);
} else {
show_all_app_windows(app, init_fullscreen);
}
}
fn build_window_with_label(
app: &AppHandle,
config: &PakeConfig,
tauri_config: &Config,
label: &str,
) -> tauri::Result<WebviewWindow> {
let window_config = config.windows.first().ok_or_else(|| {
tauri::Error::Io(std::io::Error::new(
std::io::ErrorKind::InvalidData,
"pake.json must define at least one window configuration",
))
})?;
let url = match window_config.url_type.as_str() {
"web" => {
let parsed = window_config.url.parse().map_err(|err| {
tauri::Error::Io(std::io::Error::new(
std::io::ErrorKind::InvalidInput,
format!(
"Invalid 'web' url '{}' in pake.json: {err}",
window_config.url
),
))
})?;
WebviewUrl::App(parsed)
}
"local" => WebviewUrl::App(PathBuf::from(&window_config.url)),View on GitHub (pinned to c8fe8a3f1a)