diff --git a/cmd/server/main.go b/cmd/server/main.go index 8068458..1609e89 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -304,6 +304,11 @@ func main() { } else { // Redirect all standard logging to the file log.SetOutput(logFile) + defer func() { + if closeErr := logFile.Close(); closeErr != nil { + fmt.Fprintf(os.Stderr, "Failed to close log file: %v\n", closeErr) + } + }() } // Critical: Use ServeStdio WITHOUT any console output to stdout diff --git a/pkg/dbtools/dbtools.go b/pkg/dbtools/dbtools.go index 902ada9..6f95132 100644 --- a/pkg/dbtools/dbtools.go +++ b/pkg/dbtools/dbtools.go @@ -1072,7 +1072,8 @@ func getBasicSchemaInfo(ctx context.Context, db db.Database, dbID, dbType string rows, err := db.Query(ctx, query) if err != nil { - // Return empty schema if query fails + // Log the error but return empty schema to avoid breaking the tool + logger.Warn("Failed to get basic schema for database %s: %v", dbID, err) return result } defer func() {