{"record":{"id":"40ce79f3132fb76f","repo":"gitbutlerapp/gitbutler","slug":"failed-to-join-thread-e","errorCode":null,"errorMessage":"Failed to join thread: {e:?}","messagePattern":"Failed to join thread: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but-forge/src/ci.rs","lineNumber":119,"sourceCode":"            let owner = owner.clone();\n            let repo = repo.clone();\n            let storage = storage.clone();\n            let reference = reference.to_string();\n            let reference_for_checks = reference.clone();\n\n            let checks = std::thread::spawn(move || {\n                tokio::runtime::Runtime::new()\n                    .unwrap()\n                    .block_on(but_github::checks::list_for_ref(\n                        preferred_account.as_ref(),\n                        &owner,\n                        &repo,\n                        &reference,\n                        &storage,\n                    ))\n            })\n            .join()\n            .map_err(|e| anyhow::anyhow!(\"Failed to join thread: {e:?}\"))?;\n            checks.map(|maybe_runs| {\n                maybe_runs.map(|runs| {\n                    runs.into_iter()\n                        .map(|check| {\n                            let mut ci_check = CiCheck::from(check);\n                            ci_check.reference = reference_for_checks.to_string();\n                            ci_check\n                        })\n                        .collect()\n                })\n            })\n        }\n        ForgeName::GitLab => {\n            let preferred_account = preferred_forge_user\n                .as_ref()\n                .and_then(|user| user.gitlab().cloned());\n\n            // Clone owned data for thread","sourceCodeStart":101,"sourceCodeEnd":137,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but-forge/src/ci.rs#L101-L137","documentation":"After spawning the worker thread that lists GitLab pipeline jobs for a reference, ci_checks_for_ref calls join(). If the thread panicked (rather than returning Err), join yields Err and this message wraps it, discarding the panic payload's readability. It indicates the CI check query crashed rather than failing gracefully.","triggerScenarios":"The GitLab checks worker thread panics while running list_pipeline_jobs_for_ref — e.g. an unwrap on API data, poisoned mutex on shared storage, or tokio runtime issue inside the thread.","commonSituations":"Unexpected GitLab API response shapes hitting unwrap/expect; concurrent access poisoning shared storage; panicking async runtime setup inside the thread.","solutions":["Retry fetching CI checks (transient panic cause may be gone)","Inspect the debug-formatted payload and fix the underlying panic in the checks code path","Capture the join error payload in the message for diagnosis; consider running the async work on a shared runtime instead of a thread"],"exampleFix":"// before\n.join().map_err(|e| anyhow::anyhow!(\"Failed to join thread: {e:?}\"))?;\n// after\n.join().map_err(|e| anyhow::anyhow!(\"CI checks thread panicked: {e:?}\").context(\"fetching gitlab checks\"))??;","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"match fetch_ci_checks() {\n    Err(e) if e.to_string().contains(\"Failed to join thread\") => {\n        eprintln!(\"CI worker panicked: {e:#}\"); retry_with_backoff()\n    }\n    other => other,\n}","preventionTips":["Avoid unwraps on forge API response data in the checks path","Retry transient CI fetches with backoff","Log the join error payload ({e:?}) to capture the underlying panic"],"tags":["threading","panic","gitlab","ci"],"backgroundTag":"thread-interrupted","analyzedSha":"58e5313667b857ef39a730e380af31816a7b1768","analyzedAt":"2026-09-18T06:50:32.052Z","contentChangedAt":"2026-09-18T06:50:32.052Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}