{"record":{"id":"b0f35a4d0adfdf03","repo":"tw93/Pake","slug":"invalid-web-url-in-pake-json-err","errorCode":null,"errorMessage":"Invalid 'web' url '{}' in pake.json: {err}","messagePattern":"Invalid 'web' url '(.+?)' in pake\\.json: (.+?)","errorType":"validation","errorClass":"tauri::Error","httpStatus":null,"severity":"critical","filePath":"src-tauri/src/app/window.rs","lineNumber":346,"sourceCode":"    }\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)),\n        other => {\n            return Err(tauri::Error::Io(std::io::Error::new(\n                std::io::ErrorKind::InvalidInput,\n                format!(\"url_type must be 'web' or 'local', got '{other}'\"),\n            )));\n        }\n    };\n","sourceCodeStart":328,"sourceCodeEnd":364,"githubUrl":"https://github.com/tw93/Pake/blob/c8fe8a3f1a115428e3555c06b3de9b7458aa0d54/src-tauri/src/app/window.rs#L328-L364","documentation":"When pake.json declares url_type 'web', build_window_with_label parses the url string into a tauri::Url (WebviewUrl::External); a malformed URL aborts window creation with this formatted error containing the offending value and the underlying parse error.","triggerScenarios":"set_window or open_additional_window runs with a windows[0].url that fails Url::parse, e.g. missing scheme, invalid characters, or whitespace.","commonSituations":"User passes an unescaped URL via the CLI (spaces, unicode); config hand-edited to 'example.com' without https://; shell quoting mangling the URL at build time.","solutions":["Fix the url in the source pake.json to an absolute, valid URL with scheme (https://...).","Re-run the pake CLI build so the corrected config is embedded.","If passing via CLI, quote the URL and percent-encode special characters."],"exampleFix":"// before (pake.json)\n{ \"url\": \"example com\", \"url_type\": \"web\" }\n// after\n{ \"url\": \"https://example.com\", \"url_type\": \"web\" }","handlingStrategy":"validation","validationCode":"const u = new URL(cfg.url);\nif (!/^https?:$/.test(u.protocol)) throw new Error(`web url must be absolute http(s): ${cfg.url}`);","typeGuard":"const isValidWebUrl = (s) => { try { const u = new URL(s); return u.protocol === 'https:' || u.protocol === 'http:'; } catch { return false; } };","tryCatchPattern":"match build_window_with_label(...) { Err(e) if e.to_string().contains(\"Invalid 'web' url\") => eprintln!(\"fix url in pake.json: {e}\"), Err(e) => return Err(e), Ok(w) => w }","preventionTips":["Always pass fully-qualified http(s) URLs to the pake CLI and quote them in shells","URL-encode path segments with special characters before building","Validate the URL with new URL() in the packaging step before writing pake.json"],"tags":["url","configuration","tauri"],"backgroundTag":"invalid-url-format","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"}