{"record":{"id":"2072b33530b134aa","repo":"stamparm/maltrail","slug":"trail-reload-failed-e","errorCode":null,"errorMessage":"trail reload failed ({e})","messagePattern":"trail reload failed \\((.+?)\\)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sensor/src/main.rs","lineNumber":579,"sourceCode":"                                         {:.0}% floor); keeping the current set. If this drop is real, \\\n                                         restart the sensor or lower 'TRAIL_RELOAD_MIN_RATIO'\",\n                                        thousands(incoming),\n                                        thousands(current),\n                                        cfg_reload.trail_reload_min_ratio * 100.0\n                                    ),\n                                    true,\n                                );\n                            } else {\n                                reg_reload.trail_count.store(incoming, Ordering::Relaxed);\n                                store_reload.publish(db);\n                                reg_reload.trail_generation.store(store_reload.generation(), Ordering::Relaxed);\n                                reg_reload.reloads_ok.fetch_add(1, Ordering::Relaxed);\n                                cprintln!(\"[i] reloaded {} trails\", thousands(stats.loaded as u64));\n                            }\n                        }\n                        Err(e) => {\n                            reg_reload.reloads_failed.fetch_add(1, Ordering::Relaxed);\n                            output::log_error(&format!(\"trail reload failed ({e})\"), true);\n                        }\n                    }\n                }\n            })\n            .ok();\n    }\n\n    // --- Prometheus endpoint ---------------------------------------------------\n    // Opt-in, and never fatal: a sensor that cannot bind its metrics port must still detect.\n    if !cfg.stats_address.is_empty() {\n        match maltrail_sensor::stats::spawn(&cfg.stats_address, registry.clone(), Instant::now()) {\n            Ok(bound) => {\n                if !args.quiet {\n                    cprintln!(\"[i] metrics endpoint: http://{bound}/metrics\");\n                }\n            }\n            Err(e) => {\n                ceprintln!(\"[!] metrics endpoint disabled: {e}\");","sourceCodeStart":561,"sourceCodeEnd":597,"githubUrl":"https://github.com/stamparm/maltrail/blob/77cfb06d7606506d101bbcec0786c77166c4255e/sensor/src/main.rs#L561-L597","documentation":"When the periodic trail update task returns Err(e), the sensor logs \"trail reload failed ({e})\" via output::log_error, increments the reloads_failed metric, and continues running with the previously loaded trails. It signals the trail refresh cycle itself failed (download/parse/load), not that trails were rejected for safety.","triggerScenarios":"The trailupdate refresh future returns an error inside the periodic loop in run(): network failure downloading the trails archive, I/O error reading cfg.trails_file, or a parse failure of the downloaded format.","commonSituations":"Outbound connectivity loss or DNS failures on the sensor host; corrupt or truncated download; filesystem permission issues on the trails file path; upstream server returning an error page instead of the trails data.","solutions":["Read the ({e}) detail in the log to identify the exact failure (network vs IO vs parse).","Check outbound connectivity/DNS from the sensor host and retry the update cycle.","Validate the trails file at cfg.trails_file is readable and not corrupted (check permissions and size).","Confirm the upstream trails URL is still valid and returning the expected format."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// preflight the trails source before the cycle\nlet resp = reqwest::get(&trails_url).await?;\nif !resp.status().is_success() { bail!(\"trails source returned {}\", resp.status()); }","typeGuard":null,"tryCatchPattern":"match refresh_trails().await {\n    Err(e) => { log::warn!(\"trail reload failed ({e}); will retry next cycle\"); schedule_retry_with_backoff(); }\n    Ok(_) => {}\n}","preventionTips":["Alert on reloads_failed counter increases","Run trail updates on a schedule with backoff and retry","Keep the previous trails file so a failed update never leaves you empty"],"tags":["rust","trails","update","network"],"backgroundTag":"http-request-failed","analyzedSha":"77cfb06d7606506d101bbcec0786c77166c4255e","analyzedAt":"2026-09-13T03:50:16.010Z","contentChangedAt":"2026-09-13T03:50:16.010Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}