View Issue Details

IDProjectCategoryView StatusLast Update
0007662Talerlibeufin-bankpublic2026-08-29 19:10
Reportersebasjm Assigned ToResolution deadline
ImplementerReviewer 
Release signed byDeployed by 
VerifierCommunicator 
Data protection authority notification requiredNo  
CSIRT notification requiredNo  
Estimated effort (hours)Actual effort (hours)0 
Fast-trackNo
Work packagenone
PrioritynormalSeveritytweakReproducibilityalways
Status acknowledgedResolutionopen 
Target Versionpost-1.0 
Summary0007662: error does not provide the field where the validation is made
DescriptionSome validation show the field where the error is, but for the username looks like not. It will be nice to have the some kind of error that help fixing the problem.

Also, I couldn't find documentation of this validations.

curl 'https://sandbox-libeufin.taler.ar/demobanks/default/circuit-api/accounts' -d '{"username":"1","password":"1","name":"the name","contact_data": {},"cashout_address":"payto://iban/DE123123"}' -v

  "error" : {
    "type" : "util-error",
    "description" : "Invalid resource name. The first character must be a lowercase letter, and all following characters (except for the last character) must be a dash, lowercase letter, or digit. The last character must be a lowercase letter or digit."
  }
TagsNo tags attached.

Required notifications

Address or linkRemarkAdded byNotifiedActions

Activities

Antoine A

2023-12-02 02:42

manager   ~0020681

`kotlinx.serialization` is the official Kotlin serialization library we use for JSON. It loses parsing context when the parsing exception doesn't come from the library, this is a [problem](https://github.com/Kotlin/kotlinx.serialization/issues/2165) [known](https://github.com/Kotlin/kotlinx.serialization/issues/316) and they don't seem to be in a hurry to fix it as the first issue is from 2018.
If we don't want to wait for them to fix this properly, we can switch to another library like [moshi](https://github.com/square/moshi) which handles this [better](https://github.com/square/moshi#fails-gracefully). It's not trivial, and switching to an unofficial library is not an easy decision to make, even if Square is a trusted open source contributor.

Christian Grothoff

2023-12-02 07:40

manager   ~0020682

I'm confused, what does this have to do with the JSON parser? The JSON seems well-formed here. I assume *we* are somewhere throwing an exception in the user name validation. That's fine, but as *we* throw that exception, we should be able to include the field name in our exception object and/or in our exception error message, right?

Antoine A

2023-12-02 07:52

manager   ~0020683

In our code, we have an `IbanPayto` type and code that tells `kotlinx.serialization` how to parse it from a JSON string. When this function is called, we do not know where we are in the JSON, this context information is not given to us, so when we throw an exception, we can't provide that context. Then, when `kotlinx.serialization` caught our exception, because the error is not thrown by the library itself, they choose not to provide the JSON error path but simply propagate the error. This is why every time an error is caused by our custom types (for example a JSON string that is a TalerAmount or an IbanPayto), we lose the error path.

Christian Grothoff

2023-12-02 07:58

manager   ~0020684

Eh, the error reported in this bug seems clearly about the username, not the payto://-URI. And in both cases, you can still report that this was about a payto://-URI or about a username, which would be much clearer than the current message that doesn't mention the data type involved in the failure at all.

Antoine A

2023-12-02 08:09

manager   ~0020685

With libeufin-bank the request from the issue works whithout payto uri:
curl 'http://127.0.0.1:8080/accounts' -H 'Content-Type: application/json' -d '{"username":"1","password":"1","name":"the name","contact_data": {}}' -v
{
    "internal_payto_uri": "payto://iban/DE3192435642004"
}

But I do not consider this error fixed because of this new error:
curl 'http://127.0.0.1:8080/accounts' -H 'Content-Type: application/json' -d '{"username":"1","password":"1","name":"the name","contact_data": {},ca
sshout_payto_uri":"payto://iban/DE12312"}' -v
{
    "code": 22,
    "hint": "Failed to convert request body to class tech.libeufin.bank.RegisterAccountRequest",
    "detail": "Iban malformed, modulo is 59 expected 1"
}

Christian Grothoff

2023-12-02 10:01

manager   ~0020686

Eh, but that seems like a perfectly good error message to give when the IBAN checksum is invalid. What's wrong with that?

sebasjm

2023-12-02 14:57

developer   ~0020709

from my POV this is only for development/testing when the API change, not something the user should see and something I can keep up if we have the proper API change notifications. It would be nice to have since I can use this error message to fix without asking.

It also happen with the `update currency conversion` where the error was "wrong currency" but i didn't know which field. So a good generic solution will be good.

That said, I'm ok with keeping this post 1.0 if this requires a lib change.

Antoine A

2024-07-01 09:54

manager   ~0022774

Pending on kotlinx.serialization to supports this

Issue History

Date ModifiedUsernameFieldChange
2023-02-07 14:34sebasjmNew Issue
2023-02-07 14:34sebasjmStatusnew => assigned
2023-02-07 14:34sebasjmAssigned To => MS
2023-04-11 09:30MSStatusassigned => acknowledged
2023-04-13 18:26Florian DoldCategorysandbox => libeufin sandbox
2023-04-13 18:26Florian DoldProjectlibeufin => Taler
2023-04-13 18:26Florian DoldCategorylibeufin sandbox => General
2023-04-13 19:44Florian DoldCategoryGeneral => libeufin-sandbox
2023-04-13 19:44Florian DoldProduct VersionGit master =>
2023-06-29 10:03MSTarget Version0.9.3 => 0.9.4
2023-09-03 16:21Christian GrothoffAssigned ToMS => Antoine A
2023-09-23 13:26Christian GrothoffCategorylibeufin-sandbox => libeufin-bank
2023-12-02 02:42Antoine ANote Added: 0020681
2023-12-02 07:40Christian GrothoffNote Added: 0020682
2023-12-02 07:52Antoine ANote Added: 0020683
2023-12-02 07:58Christian GrothoffNote Added: 0020684
2023-12-02 08:09Antoine ANote Added: 0020685
2023-12-02 10:01Christian GrothoffNote Added: 0020686
2023-12-02 14:57sebasjmNote Added: 0020709
2023-12-22 13:55Christian GrothoffTarget Version0.9.4 => post-1.0
2023-12-24 05:26Christian GrothoffStatusacknowledged => assigned
2024-07-01 09:54Antoine AStatusassigned => feedback
2024-07-01 09:54Antoine ANote Added: 0022774
2024-07-28 19:52Christian GrothoffSeverityminor => tweak
2025-05-08 20:42Christian GrothoffAssigned ToAntoine A =>
2025-05-08 20:42Christian GrothoffStatusfeedback => acknowledged
2025-05-08 20:42Christian GrothoffTarget Versionpost-1.0 =>
2026-08-29 19:10Florian DoldTarget Version => post-1.0