From 66ec1bb9208446eb8564dacf5bc2a678097165c3 Mon Sep 17 00:00:00 2001 From: Junyi Ou Date: Tue, 13 Oct 2026 13:10:54 -0400 Subject: [PATCH] fix(dgw): ignore bad agent_tunnel.db when tunnel is off With the agent tunnel off, a 2026.3 agent_tunnel.db that can't be imported no longer stops the Gateway from starting; the failure is logged as a warning. The import still runs when the tunnel is off, so turning the tunnel back on later keeps the enrolled Agents. With the tunnel on, a failed import still stops the start. --- devolutions-gateway/src/service.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/devolutions-gateway/src/service.rs b/devolutions-gateway/src/service.rs index 258e15d23..55434fec0 100644 --- a/devolutions-gateway/src/service.rs +++ b/devolutions-gateway/src/service.rs @@ -276,9 +276,18 @@ async fn spawn_tasks(conf_handle: ConfHandle) -> anyhow::Result { let monitoring_state = Arc::new(network_monitor::State::new(Arc::new(filesystem_monitor_config_cache))?); let data_dir = config::get_data_dir(); - agent_tunnel_libsql::import_2026_3_0_database(&data_dir) + let import_result = agent_tunnel_libsql::import_2026_3_0_database(&data_dir) .await - .context("failed to import the 2026.3.0 agent tunnel database")?; + .context("failed to import the 2026.3.0 agent tunnel database"); + match import_result { + Ok(()) => {} + Err(error) if conf.agent_tunnel.enabled => return Err(error), + // The agent tunnel is off, so a bad old file must not stop the Gateway. + Err(error) => warn!( + error = format!("{error:#}"), + "Failed to import the 2026.3.0 agent tunnel database, continuing because the agent tunnel is disabled" + ), + } let gateway_db = gateway_db::GatewayDb::open(&data_dir) .await .context("failed to open the gateway database")?;