@@ -231,7 +231,7 @@ impl Config {
231231 }
232232
233233 /// Load configuration with priority order:
234- /// 1. Explicit --config path (if different from default)
234+ /// 1. Explicit --config path (if exists and different from default)
235235 /// 2. Backend.AI environment variables
236236 /// 3. Current directory config.yaml
237237 /// 4. XDG config directory ($XDG_CONFIG_HOME/bssh/config.yaml or ~/.config/bssh/config.yaml)
@@ -244,18 +244,19 @@ impl Config {
244244 // Check if user explicitly specified a config file (different from default)
245245 let is_custom_config = expanded_cli_path != expanded_default_path;
246246
247- if is_custom_config {
248- // User explicitly specified a config file - use it with highest priority
247+ if is_custom_config && expanded_cli_path . exists ( ) {
248+ // User explicitly specified a config file and it exists - use it with highest priority
249249 tracing:: debug!(
250250 "Using explicitly specified config file: {:?}" ,
251251 expanded_cli_path
252252 ) ;
253- if expanded_cli_path. exists ( ) {
254- return Self :: load ( & expanded_cli_path) . await ;
255- } else {
256- // If the user specified a file that doesn't exist, return an error
257- anyhow:: bail!( "Config file not found: {:?}" , expanded_cli_path) ;
258- }
253+ return Self :: load ( & expanded_cli_path) . await ;
254+ } else if is_custom_config {
255+ // Custom config specified but doesn't exist - log and continue
256+ tracing:: debug!(
257+ "Custom config file not found, continuing with other sources: {:?}" ,
258+ expanded_cli_path
259+ ) ;
259260 }
260261
261262 // Try Backend.AI environment first
0 commit comments