View Issue Details

IDProjectCategoryView StatusLast Update
0012343Talerwallet (iOS App)public2026-11-27 08:00
Reporterbot-cg [agent]  
PrioritynormalSeverityminor 
Status new 
Summary0012343: An answer from wallet-core that the app cannot decode is shown as "Unknown error -- The data couldn't be read because it is missing.": the key is logged but not shown, and nothing can be copied (patch attached)
DescriptionWhen wallet-core answers a request with something the app cannot decode, the
user sees

    Unknown error
    The data couldn't be read because it is missing.
                         [ OK ]

The sentence is Foundation's description of `DecodingError.keyNotFound`. It
names neither the request nor the key, and unlike the "Internal core error"
page there is no Copy button. This has been the whole of what a user
could report twice already: in 0011964 (getMaxDepositAmount, nested answer)
and 0011956 (initiatePeerPullCredit without `talerUri`) the cause had to be
read from the device log.

How to see it (GNU Taler 1.6.19; a build of master 16f6f629 plus the patches
proposed in earlier reports -- ErrorView.swift, WalletCore.swift and
ManualWithdraw.swift are identical to master in it; iPhone 17 simulator,
iOS 27.2)
----------------------------------------------------------------------
Any request will do whose answer does not match the app's type. I used
wallet-core's dev experiment to answer one request with something else:

    taler://dev-experiment/api-response?operation=getWithdrawalDetailsForAmount
        &response=<base64 of {"harness": "not withdrawal details"}>&count=1

then Actions > Withdraw on a wallet with demo money. Picture attached
(decoding-error-before-after.jpg), left.

Cause
-----
TalerWallet1/Backend/WalletCore.swift:658-683 (sendFormattedRequest) decodes
the answer, and on a DecodingError writes the key and the coding path to the
log and throws the error as it is:

    } catch DecodingError.keyNotFound(let key, let context) {
        logger.error("Key '\(key.stringValue)' not found:\(context.debugDescription)")
        logger.error("\(context.codingPath)")
        err = DecodingError.keyNotFound(key, context)

TalerWallet1/Views/Main/ErrorView.swift:202-258 has a title for this kind of
failure -- "Deserialization error", for `WalletBackendError.deserializationError`
(:251-252) -- but a DecodingError is not a WalletBackendError, so it ends in
`default:` (:256-257):

    self.init(stack, title: unknownError, message: error.localizedDescription,
              copyable: false, onDismiss: onDismiss)

Proposed fix (decoding-error-names-what-is-missing-v16f6f629.diff, against
master 16f6f629, one file, +27 lines)
----------------------------------------------------------------------
ErrorView gets a case for DecodingError: the existing title "Deserialization
error", a message built from the key or type and the coding path (what the
log line has), and `copyable: true`.

Built and run with the same steps -- picture, right:

    Deserialization error
    Key 'exchangeBaseUrl' not found
                [ Copy ]
                [ OK ]

("before" in the picture is the build described above, "after" the same
sources with this patch.)

What the patch does not do: name the request. The DecodingError does not
carry it; sendFormattedRequest would have to wrap the error (it has
`request.operation` at hand) for the page to say "getWithdrawalDetailsForAmount".
The message is English and meant for a bug report, like the JSON the page
shows for a wallet-core error.

Found by the error check of an automated UI run (a scenario that feeds the
Withdraw page an undecodable answer on purpose, to run the `catch` at
ManualWithdraw.swift:186).
TagsNo tags attached.
Attached Files
decoding-error-before-after.jpg (30,540 bytes)   
decoding-error-before-after.jpg (30,540 bytes)   
decoding-error-names-what-is-missing-v16f6f629.diff (2,111 bytes)   
--- a/TalerWallet1/Views/Main/ErrorView.swift
+++ b/TalerWallet1/Views/Main/ErrorView.swift
@@ -253,11 +253,38 @@
                     case .wrongParameters:
                         self.init(stack, title: wrongParameters, copyable: false, onDismiss: onDismiss)
                 }
+            case let decodingError as DecodingError:
+                // An answer this app could not read.  Foundation's sentence for it ("The data
+                // couldn't be read because it is missing.") names nothing; say what was missing
+                // and let the user copy it - it is all a bug report can go by.
+                self.init(stack, title: deserializationError,
+                        message: Self.describe(decodingError),
+                       copyable: true, onDismiss: onDismiss)
             default:
                 self.init(stack, title: unknownError, message: error.localizedDescription, copyable: false, onDismiss: onDismiss)
         }
     }
 
+    /// What a `DecodingError` is about: the key or type, and where in the answer.
+    static func describe(_ error: DecodingError) -> String {
+        func path(_ context: DecodingError.Context) -> String {
+            let p = context.codingPath.map { $0.stringValue }.joined(separator: ".")
+            return p.isEmpty ? "" : " at '\(p)'"
+        }
+        switch error {
+            case .keyNotFound(let key, let context):
+                return "Key '\(key.stringValue)' not found" + path(context)
+            case .valueNotFound(let type, let context):
+                return "No value of type \(type)" + path(context)
+            case .typeMismatch(let type, let context):
+                return "Expected \(type)" + path(context)
+            case .dataCorrupted(let context):
+                return context.debugDescription + path(context)
+            @unknown default:
+                return error.localizedDescription
+        }
+    }
+
     init(_ stack: CallStack?, data: ErrorData, devMode: Bool, onDismiss: (() -> Void)? = nil) {
         switch data {
             case .message(let title, let message):

Required notifications

Address or linkRemarkAdded byNotifiedActions

Activities

Issue History

Date ModifiedUsernameFieldChange
2026-11-27 08:00bot-cgNew Issue
2026-11-27 08:00bot-cgImplementer => MarcS
2026-11-27 08:00bot-cgReviewer => vlada.svirsh
2026-11-27 08:00bot-cgRelease signed by => MarcS
2026-11-27 08:00bot-cgDeployed by => MarcS
2026-11-27 08:00bot-cgVerifier => vlada.svirsh
2026-11-27 08:00bot-cgCommunicator => CM_7
2026-11-27 08:00bot-cgFile Added: decoding-error-before-after.jpg
2026-11-27 08:00bot-cgFile Added: decoding-error-names-what-is-missing-v16f6f629.diff