From 3c4c728ed5712a3ea180913e01d457d7fd9e4d28 Mon Sep 17 00:00:00 2001 From: iris <2+iris@noreply.localhost> Date: Fri, 28 Aug 2026 03:21:58 -0400 Subject: [PATCH] Stop the session list saying "Couldn't reach the server" twice On screen it read: "Couldn't reach the server: Couldn't reach the server at https://10.0.2.2:8443 (ConnectException ...)". Api.kt writes a whole sentence -- the address, the exception, and what to check -- because that message has to be actionable on a device with no logcat; the list then prefixed it with a shortened version of the same claim. The usage screen, showing the identical failures, prints the message alone and reads correctly, so this was one caller disagreeing with the other about what a failure looks like. The prefix was also a guess the caller could not make. `LoadState.Error` here also carries a failed *delete*, which the server may well have answered -- reaching it fine and refusing -- and the prefix said it had not been reached at all. Found by looking at it with the server stopped, which is the only way this was ever going to show up: it compiles, and the happy path looks perfect. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_017xn8nHw1tw1R6PtiY1eEtw --- .../main/kotlin/com/example/aiapp/SessionListScreen.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/androidApp/src/main/kotlin/com/example/aiapp/SessionListScreen.kt b/app/androidApp/src/main/kotlin/com/example/aiapp/SessionListScreen.kt index 47b5f05..c36d310 100644 --- a/app/androidApp/src/main/kotlin/com/example/aiapp/SessionListScreen.kt +++ b/app/androidApp/src/main/kotlin/com/example/aiapp/SessionListScreen.kt @@ -86,8 +86,14 @@ fun SessionListScreen( when (val state = listState) { is LoadState.Loading -> CircularProgressIndicator() + // The message as Api.kt wrote it, with nothing added: it is + // already a whole sentence naming the address and what to + // check, so a prefix here read "Couldn't reach the server: + // Couldn't reach the server at ...". It was also a guess -- + // a delete that the server itself refused had reached it + // fine. is LoadState.Error -> Text( - "Couldn't reach the server: ${state.message}", + state.message, color = MaterialTheme.colorScheme.error, ) is LoadState.Loaded -> {