{"record":{"id":"802906782e0754ab","repo":"gitbutlerapp/gitbutler","slug":"product-name-not-set","errorCode":null,"errorMessage":"product name not set","messagePattern":"product name not set","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/gitbutler-tauri/src/logs.rs","lineNumber":113,"sourceCode":"/// It is pretty much the same as `LevelFilter` in debug builds.\nfn should_log(level: Option<Level>, meta: &tracing::Metadata<'_>) -> bool {\n    let Some(level) = level else {\n        return false;\n    };\n    if *meta.level() > level {\n        return false;\n    }\n    if level > Level::DEBUG {\n        return true;\n    }\n    meta.module_path().is_none_or(|p| {\n        p.starts_with(\"gitbutler_\") || p.starts_with(\"but::\") || p.starts_with(\"but_\")\n    })\n}\n\nfn get_server_addr(app_handle: &AppHandle) -> (Ipv4Addr, u16) {\n    let config = app_handle.config();\n    let product_name = config.product_name.as_ref().expect(\"product name not set\");\n    let port = if product_name.eq(\"GitButler\") {\n        6667\n    } else if product_name.eq(\"GitButler Nightly\") {\n        6668\n    } else {\n        6669\n    };\n    (Ipv4Addr::LOCALHOST, port)\n}\n\n/// Originally based on https://github.com/tokio-rs/tracing/blob/44861cad7a821f08b3c13aba14bb8ddf562b7053/tracing-appender/src/rolling.rs#L571\n#[instrument(err(Debug))]\nfn prune_old_logs(\n    log_directory: &Path,\n    log_filename_prefix: Option<&str>,\n    log_filename_suffix: Option<&str>,\n    max_files: usize,\n) -> anyhow::Result<()> {","sourceCodeStart":95,"sourceCodeEnd":131,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/caf1f223d3cfb94488c9198ad34487c6006c648f/crates/gitbutler-tauri/src/logs.rs#L95-L131","documentation":"get_server_addr() picks the devtools/tokio-console port (6667/6668/6669) by comparing app_handle.config().product_name against known names. Tauri's productName config field is optional; when the running app's Tauri context has no productName, config.product_name is None and expect(\"product name not set\") panics inside logs::init.","triggerScenarios":"Any startup path reaching get_server_addr (performance/tokio-console logging setup) in a build whose Tauri configuration lacks productName: custom forks trimming tauri.conf.json, test apps, or contexts generated without the field.","commonSituations":"Forking the desktop app and slimming tauri.conf.json, E2E/test builds using a different config, or Tauri version upgrades that move/rename the productName field.","solutions":["Set productName in the Tauri config (\"GitButler\", \"GitButler Nightly\", \"GitButler Test\", or your fork's name)","If the field is legitimately optional in your build, default it instead of expecting (see exampleFix)","Debug-print app_handle.config().product_name at startup to confirm what the running context actually contains"],"exampleFix":"// before\nlet product_name = config.product_name.as_ref().expect(\"product name not set\");\n\n// after\nlet product_name = config.product_name.as_deref().unwrap_or(\"GitButler\");","handlingStrategy":"validation","validationCode":"// Before startup, confirm the packaged config carries productName\nlet cfg: tauri_utils::config::Config = serde_json::from_str(include_str!(\"../tauri.conf.json\"))?;\nassert!(cfg.product_name.is_some(), \"productName missing in tauri.conf.json\");","typeGuard":"fn has_product_name(app: &tauri::AppHandle) -> bool {\n    app.config().product_name.is_some()\n}","tryCatchPattern":null,"preventionTips":["Always set productName in tauri.conf.json, including forks and test apps","After Tauri upgrades, re-check config schema - optional fields stay optional and code must not assume them","Default unknown product names gracefully instead of expecting, so channel variants don't crash"],"tags":["tauri","config","product-name","logging","startup","panic"],"backgroundTag":"tauri-config-field-missing","analyzedSha":"caf1f223d3cfb94488c9198ad34487c6006c648f","analyzedAt":"2026-08-20T07:55:40.983Z","schemaVersion":2},"datasetVersion":"2026-08-31T22:30:34.772Z"}