From 844560ab11b3fd1c687bcbaa00fdbcf9cca29342 Mon Sep 17 00:00:00 2001 From: jimleerx Date: Fri, 6 Feb 2026 20:08:20 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=9B=A0=EF=B8=8F=20fix:=E5=85=A5=E7=AB=99?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=97=B6=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/handler/manage.go | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/internal/handler/manage.go b/internal/handler/manage.go index 99ac9b1..b706721 100644 --- a/internal/handler/manage.go +++ b/internal/handler/manage.go @@ -1548,12 +1548,26 @@ func (h *ManageHandler) manageInbound(w http.ResponseWriter, r *http.Request) { log.Printf("[Manage] Warning: Failed to remove inbound from config: %v", configErr) } - // Success if at least one operation succeeded - if runtimeErr != nil && configErr != nil { - writeError(w, http.StatusInternalServerError, fmt.Sprintf("Failed to remove inbound: runtime=%v, config=%v", runtimeErr, configErr)) + // Success if config operation succeeded (runtime removal is optional) + // The inbound might not exist in runtime if Xray wasn't restarted after config change + if configErr != nil { + // Config file operation failed + if runtimeErr != nil { + // Both failed - check if it's just "not found" errors + if strings.Contains(runtimeErr.Error(), "not enough information") { + // Xray says the inbound doesn't exist in runtime, which is fine + // Just report config error + writeError(w, http.StatusInternalServerError, fmt.Sprintf("Failed to remove inbound from config: %v", configErr)) + } else { + writeError(w, http.StatusInternalServerError, fmt.Sprintf("Failed to remove inbound: runtime=%v, config=%v", runtimeErr, configErr)) + } + } else { + writeError(w, http.StatusInternalServerError, fmt.Sprintf("Failed to remove inbound from config: %v", configErr)) + } return } + // Config succeeded, runtime error is acceptable (inbound might not be loaded) writeJSON(w, http.StatusOK, map[string]interface{}{ "success": true, "message": "Inbound removed successfully",