diff --git a/Services/ChatService.cs b/Services/ChatService.cs
index 91ba71e..4ea0b8c 100644
--- a/Services/ChatService.cs
+++ b/Services/ChatService.cs
@@ -593,6 +593,9 @@ Für welche Plattform soll die App entwickelt werden? Web, Mobile oder Desktop?
}
}
+ // Post-Processing: Offener ask_user_choice tool_use ohne tool_result → synthetisches tool_result einfügen
+ FixOrphanedAskUserChoice(history);
+
// Post-Processing: Orphaned web_search server_tool_use entfernen
// Bei alten DB-Einträgen wurde web_search_tool_result nur als Sources-Array gespeichert,
// nicht als Raw-JSON → BuildHistoryFromDb überspringt sie (Array-Check) →
@@ -677,6 +680,52 @@ Für welche Plattform soll die App entwickelt werden? Web, Mobile oder Desktop?
}
}
+ ///
+ /// Prüft ob die History mit einem offenen ask_user_choice tool_use endet (kein passendes tool_result).
+ /// Falls ja, wird ein synthetisches tool_result eingefügt – verhindert Anthropic API 400.
+ /// Passiert wenn der User einfach Text schreibt statt eine Choice zu wählen.
+ ///
+ private static void FixOrphanedAskUserChoice(List