Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Date decoding error #91

Open
hermanmak opened this issue May 13, 2024 · 18 comments
Open

Date decoding error #91

hermanmak opened this issue May 13, 2024 · 18 comments
Labels
bug Something isn't working

Comments

@hermanmak
Copy link

The operation couldn’t be completed. (swift_paperless.DateDecodingError error 0.)

@paulgessinger
Copy link
Owner

Oh that's interesting.

Seems like the app fails to convert some date it received somehow. What locale and specifically date format do you have configured in the backend?

Can you hop on the TestFlight and share logs from the settings screen.

@paulgessinger paulgessinger changed the title App loading from self hosted backend Date decoding error May 14, 2024
@paulgessinger paulgessinger added the bug Something isn't working label May 14, 2024
@hermanmak
Copy link
Author

Thanks for picking this up!

I've sent the logs via settings.

Locals not sure, do you mean what OCR languages? Eng, chi_tra, kor

@paulgessinger
Copy link
Owner

My guess is that the date format coming from your instance is somehow different than what my app expects. It might be that the backend language and date format configuration affects the API payloads.

The plan would be to check in the logs what payload it's failing to decode, and then figure out why.

@hermanmak
Copy link
Author

So based on that date issue, I've tried changing the date format on the server to several formats and none work, I've also tried PAPERLESS_DATE_ORDER=MDY on docker too, no good.

@paulgessinger
Copy link
Owner

Where did you sent me those logs?
If you send this from the TestFlight, I can try to figure out first of all what it is that it's trying to load.
Then we can debug further.

@hermanmak
Copy link
Author

Oh oops sorry I thought the logs were sent automatically!

I clicked export logs via the app, but where is the file located?

Thanks!

@paulgessinger
Copy link
Owner

Ah! You just have to tap again to share the logs via the share sheet. Alternatively you can use the feedback button directly

@hermanmak
Copy link
Author

Clicking share does not export any visible file... could that be broken too?

I actually think the date field may be nil, but yea I am having issue sending and logs

@paulgessinger
Copy link
Owner

paulgessinger commented May 18, 2024

Feedback also doesn't work? I've been getting lots of logs with both methods, so I don't think it's something super widespread. Might still be some issue I don't understand.

@hermanmak
Copy link
Author

Thanks for your effort, actually don't know why it has no logs to export. Here is the latest

The operation couldn’t be completed. (swift_paperless.DateDecodingError error 0.)
invalidDate(string: "2024-05-13T23:38:10.546679Z")

paulgessinger added a commit that referenced this issue May 18, 2024
Possible fix for #91
@paulgessinger
Copy link
Owner

Hey @hermanmak, that looks like a standard ISO8601 format to me, and in principle, the app tries to decode it as such.

Could you check what the response to https://example.com/api/saved_views/ is, where example.com has to be replaced with your domain? Are there any filter rules with date values?

Aside from that, I've pushed build 77 which adds some extra logging. If you manage to get the logs out of the app, I can look into this some more.

@hermanmak
Copy link
Author

Another error now

cancelled
Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLStringKey=https://paperless.hermanmak.dev/api/document_types/?page_size=100000, NSErrorFailingURLKey=https://paperless.hermanmak.dev/api/document_types/?page_size=100000, _NSURLErrorRelatedURLSessionTaskErrorKey=(
"LocalDataTask .<20>"
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask .<20>, NSLocalizedDescription=cancelled}

@paulgessinger
Copy link
Owner

This is only in the log right? If it doesn't show up in the top of the app, these errors are not an issue.

@hermanmak
Copy link
Author

Yes the only log.. just this one and the original with the date string

@paulgessinger
Copy link
Owner

Ok! Can you share the full log with me?

@hermanmak
Copy link
Author

[18/5/2024, 9:58 PM] [General] Checking login status
[18/5/2024, 9:58 PM] [API] Initializing ApiRepository with connection
[18/5/2024, 9:58 PM] [API] Getting backend versions
[18/5/2024, 9:58 PM] [General] Fetch all store request
[18/5/2024, 9:58 PM] [General] Fetch all store
[18/5/2024, 9:58 PM] [API] Getting document sequence for filter
[18/5/2024, 9:58 PM] [General] Fetch all store request
[18/5/2024, 9:58 PM] [General] App becomes active
[18/5/2024, 9:58 PM] [API] Backend version info: API version: 5, backend version: 2.8.6
[18/5/2024, 9:58 PM] [API] User API sequence has reached end (nextPage is nil)
[18/5/2024, 9:58 PM] [General] Unable to decode date from string: 2024-05-13T23:38:29.836162Z
[18/5/2024, 9:58 PM] [API] Unable to load tasks: Error Domain=swift_paperless.DateDecodingError Code=0
[18/5/2024, 9:58 PM] [API] Tag API sequence has reached end (nextPage is nil)
[18/5/2024, 9:58 PM] [API] Correspondent API sequence has reached end (nextPage is nil)
[18/5/2024, 9:58 PM] [API] SavedView API sequence has reached end (nextPage is nil)
[18/5/2024, 9:58 PM] [API] DocumentType API sequence has reached end (nextPage is nil)
[18/5/2024, 9:58 PM] [General] Unable to decode date from string: 2024-05-13T23:38:10.546679Z
[18/5/2024, 9:58 PM] [API] Error in Document API sequence: invalidDate(string: "2024-05-13T23:38:10.546679Z")
[18/5/2024, 9:58 PM] [General] DocumentList failed to load documents: Error Domain=swift_paperless.DateDecodingError Code=0
[18/5/2024, 9:58 PM] [API] StoragePath API sequence fetch was empty
[18/5/2024, 9:58 PM] [General] Fetch all store complete
[18/5/2024, 9:58 PM] [General] Fetch all store
[18/5/2024, 9:58 PM] [General] Unable to decode date from string: 2024-05-13T23:38:29.836162Z
[18/5/2024, 9:58 PM] [API] Unable to load tasks: Error Domain=swift_paperless.DateDecodingError Code=0
[18/5/2024, 9:58 PM] [API] Correspondent API sequence has reached end (nextPage is nil)
[18/5/2024, 9:58 PM] [API] StoragePath API sequence fetch was empty
[18/5/2024, 9:58 PM] [API] DocumentType API sequence has reached end (nextPage is nil)
[18/5/2024, 9:58 PM] [API] User API sequence has reached end (nextPage is nil)
[18/5/2024, 9:58 PM] [API] SavedView API sequence has reached end (nextPage is nil)
[18/5/2024, 9:58 PM] [API] Tag API sequence has reached end (nextPage is nil)
[18/5/2024, 9:58 PM] [General] Fetch all store complete
[18/5/2024, 9:58 PM] [General] App becomes inactive
[18/5/2024, 9:58 PM] [General] App goes to background
[18/5/2024, 9:58 PM] [General] App becomes inactive
[18/5/2024, 9:58 PM] [General] App becomes active
[18/5/2024, 9:58 PM] [General] Unable to decode date from string: 2024-05-13T23:38:29.836162Z
[18/5/2024, 9:58 PM] [API] Unable to load tasks: Error Domain=swift_paperless.DateDecodingError Code=0
[18/5/2024, 9:59 PM] [General] Requesting log export
[18/5/2024, 9:59 PM] [API] DocumentType API sequence has reached end (nextPage is nil)
[18/5/2024, 9:59 PM] [API] Caught error fetching https://example.com/api/document_types/?page_size=100000: Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLStringKey=https://example.com/api/document_types/?page_size=100000, NSErrorFailingURLKey=https://example.com/api/document_types/?page_size=100000, _NSURLErrorRelatedURLSessionTaskErrorKey=(
"LocalDataTask .<20>"
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask .<20>, NSLocalizedDescription=cancelled}
[18/5/2024, 9:59 PM] [API] Error in DocumentType API sequence: Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLStringKey=https://example.com/api/document_types/?page_size=100000, NSErrorFailingURLKey=https://example.com/api/document_types/?page_size=100000, _NSURLErrorRelatedURLSessionTaskErrorKey=(
"LocalDataTask .<20>"
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask .<20>, NSLocalizedDescription=cancelled}
[18/5/2024, 9:59 PM] [General] App becomes inactive
[18/5/2024, 9:59 PM] [General] App goes to background
[18/5/2024, 10:00 PM] [API] Caught error fetching https://example.com/api/tasks/: Error Domain=NSURLErrorDomain Code=-1005 "The network connection was lost." UserInfo={_kCFStreamErrorCodeKey=57, NSUnderlyingError=0x3037d8ae0 {Error Domain=kCFErrorDomainCFNetwork Code=-1005 "(null)" UserInfo={NSErrorPeerAddressKey=<CFData 0x301b832a0 [0x200aebc70]>{length = 16, capacity = 16, bytes = 0x100201bbac43ca9f0000000000000000}, _kCFStreamErrorCodeKey=57, _kCFStreamErrorDomainKey=1}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask .<21>, _NSURLErrorRelatedURLSessionTaskErrorKey=(
"LocalDataTask .<21>"
), NSLocalizedDescription=The network connection was lost., NSErrorFailingURLStringKey=https://example.com/api/tasks/, NSErrorFailingURLKey=https://example.com/api/tasks/, _kCFStreamErrorDomainKey=1}
[18/5/2024, 10:00 PM] [API] Unable to load tasks: Error Domain=NSURLErrorDomain Code=-1005 UserInfo={_kCFStreamErrorCodeKey=57, NSUnderlyingError=0x3037d8ae0 {Error Domain=kCFErrorDomainCFNetwork Code=-1005 UserInfo={NSErrorPeerAddressKey=, _kCFStreamErrorCodeKey=57, _kCFStreamErrorDomainKey=1}}, _NSURLErrorFailingURLSessionTaskErrorKey=, _NSURLErrorRelatedURLSessionTaskErrorKey=, NSLocalizedDescription=, NSErrorFailingURLStringKey=, NSErrorFailingURLKey=, _kCFStreamErrorDomainKey=1}
[18/5/2024, 10:00 PM] [General] App becomes inactive
[18/5/2024, 10:00 PM] [General] App becomes active
[18/5/2024, 10:00 PM] [General] Fetch all store request
[18/5/2024, 10:00 PM] [General] Fetch all store
[18/5/2024, 10:00 PM] [API] Getting document sequence for filter
[18/5/2024, 10:00 PM] [API] Getting document sequence for filter
[18/5/2024, 10:00 PM] [API] StoragePath API sequence fetch was empty
[18/5/2024, 10:00 PM] [General] Unable to decode date from string: 2024-05-13T23:38:29.836162Z
[18/5/2024, 10:00 PM] [API] Unable to load tasks: Error Domain=swift_paperless.DateDecodingError Code=0
[18/5/2024, 10:00 PM] [API] User API sequence has reached end (nextPage is nil)
[18/5/2024, 10:00 PM] [API] Correspondent API sequence has reached end (nextPage is nil)
[18/5/2024, 10:00 PM] [API] Tag API sequence has reached end (nextPage is nil)
[18/5/2024, 10:00 PM] [API] DocumentType API sequence has reached end (nextPage is nil)
[18/5/2024, 10:00 PM] [API] SavedView API sequence has reached end (nextPage is nil)
[18/5/2024, 10:00 PM] [General] Fetch all store complete
[18/5/2024, 10:00 PM] [General] Unable to decode date from string: 2024-05-13T23:38:10.546679Z
[18/5/2024, 10:00 PM] [API] Error in Document API sequence: invalidDate(string: "2024-05-13T23:38:10.546679Z")
[18/5/2024, 10:00 PM] [General] DocumentList failed to refresh: Error Domain=swift_paperless.DateDecodingError Code=0
[18/5/2024, 10:00 PM] [General] Unable to decode date from string: 2024-05-13T23:38:10.546679Z
[18/5/2024, 10:00 PM] [API] Error in Document API sequence: invalidDate(string: "2024-05-13T23:38:10.546679Z")
[18/5/2024, 10:00 PM] [General] DocumentList failed to refresh: Error Domain=swift_paperless.DateDecodingError Code=0
[18/5/2024, 10:01 PM] [General] App becomes inactive
[18/5/2024, 10:01 PM] [General] App goes to background
[18/5/2024, 10:02 PM] [API] Caught error fetching https://example.com/api/tasks/: Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={_kCFStreamErrorCodeKey=89, NSUnderlyingError=0x303749e30 {Error Domain=kCFErrorDomainCFNetwork Code=-999 "(null)" UserInfo={NSErrorPeerAddressKey=<CFData 0x3019b8280 [0x200aebc70]>{length = 16, capacity = 16, bytes = 0x100201bbac43ca9f0000000000000000}, _kCFStreamErrorCodeKey=89, _kCFStreamErrorDomainKey=1}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <33939EF3-14B9-480B-8D25-A2EC7A770AB3>.<31>, _NSURLErrorRelatedURLSessionTaskErrorKey=(
"LocalDataTask <33939EF3-14B9-480B-8D25-A2EC7A770AB3>.<31>"
), NSLocalizedDescription=cancelled, NSErrorFailingURLStringKey=https://example.com/api/tasks/, NSErrorFailingURLKey=https://example.com/api/tasks/, _kCFStreamErrorDomainKey=1}
[18/5/2024, 10:02 PM] [API] Unable to load tasks: Error Domain=NSURLErrorDomain Code=-999 UserInfo={_kCFStreamErrorCodeKey=89, NSUnderlyingError=0x303749e30 {Error Domain=kCFErrorDomainCFNetwork Code=-999 UserInfo={NSErrorPeerAddressKey=, _kCFStreamErrorCodeKey=89, _kCFStreamErrorDomainKey=1}}, _NSURLErrorFailingURLSessionTaskErrorKey=, _NSURLErrorRelatedURLSessionTaskErrorKey=, NSLocalizedDescription=, NSErrorFailingURLStringKey=, NSErrorFailingURLKey=, _kCFStreamErrorDomainKey=1}
[18/5/2024, 10:02 PM] [General] App becomes inactive
[18/5/2024, 10:02 PM] [General] App becomes active
[18/5/2024, 10:02 PM] [General] Unable to decode date from string: 2024-05-13T23:38:29.836162Z
[18/5/2024, 10:02 PM] [API] Unable to load tasks: Error Domain=swift_paperless.DateDecodingError Code=0
[18/5/2024, 10:02 PM] [API] Getting document sequence for filter
[18/5/2024, 10:02 PM] [General] Unable to decode date from string: 2024-05-13T23:38:10.546679Z
[18/5/2024, 10:02 PM] [API] Error in Document API sequence: invalidDate(string: "2024-05-13T23:38:10.546679Z")
[18/5/2024, 10:02 PM] [General] DocumentList failed to refresh: Error Domain=swift_paperless.DateDecodingError Code=0
[18/5/2024, 10:02 PM] [API] Getting document sequence for filter
[18/5/2024, 10:02 PM] [General] Unable to decode date from string: 2024-05-13T23:38:10.546679Z
[18/5/2024, 10:02 PM] [API] Error in Document API sequence: invalidDate(string: "2024-05-13T23:38:10.546679Z")
[18/5/2024, 10:02 PM] [General] DocumentList failed to refresh: Error Domain=swift_paperless.DateDecodingError Code=0
[18/5/2024, 10:03 PM] [General] Requesting log export
[18/5/2024, 10:03 PM] [General] Fetch all store request
[18/5/2024, 10:03 PM] [General] Fetch all store
[18/5/2024, 10:03 PM] [API] User API sequence has reached end (nextPage is nil)
[18/5/2024, 10:03 PM] [API] DocumentType API sequence has reached end (nextPage is nil)
[18/5/2024, 10:03 PM] [API] SavedView API sequence has reached end (nextPage is nil)
[18/5/2024, 10:03 PM] [API] Correspondent API sequence has reached end (nextPage is nil)
[18/5/2024, 10:03 PM] [API] Tag API sequence has reached end (nextPage is nil)
[18/5/2024, 10:03 PM] [API] StoragePath API sequence fetch was empty
[18/5/2024, 10:03 PM] [General] Fetch all store complete
[18/5/2024, 10:03 PM] [API] Getting document sequence for filter
[18/5/2024, 10:03 PM] [General] Unable to decode date from string: 2024-05-13T23:38:10.546679Z
[18/5/2024, 10:03 PM] [API] Error in Document API sequence: invalidDate(string: "2024-05-13T23:38:10.546679Z")
[18/5/2024, 10:03 PM] [General] DocumentList failed to refresh: Error Domain=swift_paperless.DateDecodingError Code=0
[18/5/2024, 10:03 PM] [General] Requesting log export
[18/5/2024, 10:03 PM] [General] Unable to decode date from string: 2024-05-13T23:38:29.836162Z
[18/5/2024, 10:03 PM] [API] Unable to load tasks: Error Domain=swift_paperless.DateDecodingError Code=0
[18/5/2024, 10:03 PM] [General] Fetch all store request
[18/5/2024, 10:03 PM] [General] Fetch all store
[18/5/2024, 10:03 PM] [API] SavedView API sequence has reached end (nextPage is nil)
[18/5/2024, 10:03 PM] [API] Correspondent API sequence has reached end (nextPage is nil)
[18/5/2024, 10:03 PM] [API] StoragePath API sequence fetch was empty
[18/5/2024, 10:03 PM] [API] User API sequence has reached end (nextPage is nil)
[18/5/2024, 10:03 PM] [API] Tag API sequence has reached end (nextPage is nil)
[18/5/2024, 10:03 PM] [API] DocumentType API sequence has reached end (nextPage is nil)
[18/5/2024, 10:03 PM] [General] Fetch all store complete
[18/5/2024, 10:03 PM] [General] App becomes inactive
[18/5/2024, 10:03 PM] [General] App goes to background
[18/5/2024, 11:28 PM] [General] App becomes inactive
[18/5/2024, 11:28 PM] [General] Unable to decode date from string: 2024-05-13T23:38:29.836162Z
[18/5/2024, 11:28 PM] [API] Unable to load tasks: Error Domain=swift_paperless.DateDecodingError Code=0
[18/5/2024, 11:28 PM] [General] App becomes active
[18/5/2024, 11:28 PM] [General] Unable to decode date from string: 2024-05-13T23:38:29.836162Z
[18/5/2024, 11:28 PM] [API] Unable to load tasks: Error Domain=swift_paperless.DateDecodingError Code=0
[18/5/2024, 11:28 PM] [API] Getting document sequence for filter
[18/5/2024, 11:28 PM] [General] Unable to decode date from string: 2024-05-13T23:38:10.546679Z
[18/5/2024, 11:28 PM] [API] Error in Document API sequence: invalidDate(string: "2024-05-13T23:38:10.546679Z")
[18/5/2024, 11:28 PM] [General] DocumentList failed to refresh: Error Domain=swift_paperless.DateDecodingError Code=0
[18/5/2024, 11:28 PM] [General] App becomes inactive
[18/5/2024, 11:28 PM] [General] App goes to background
[18/5/2024, 11:29 PM] [General] App becomes inactive
[18/5/2024, 11:29 PM] [General] App becomes active
[18/5/2024, 11:29 PM] [General] Unable to decode date from string: 2024-05-13T23:38:29.836162Z
[18/5/2024, 11:29 PM] [API] Unable to load tasks: Error Domain=swift_paperless.DateDecodingError Code=0
[18/5/2024, 11:29 PM] [API] Getting document sequence for filter
[18/5/2024, 11:29 PM] [General] Unable to decode date from string: 2024-05-13T23:38:10.546679Z
[18/5/2024, 11:29 PM] [API] Error in Document API sequence: invalidDate(string: "2024-05-13T23:38:10.546679Z")
[18/5/2024, 11:29 PM] [General] DocumentList failed to refresh: Error Domain=swift_paperless.DateDecodingError Code=0
[18/5/2024, 11:30 PM] [General] App becomes inactive
[18/5/2024, 11:30 PM] [General] App goes to background
[19/5/2024, 12:20 AM] [General] App becomes inactive
[19/5/2024, 12:20 AM] [General] App becomes active
[19/5/2024, 12:20 AM] [API] Caught error fetching https://example.com/api/tasks/: Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLStringKey=https://example.com/api/tasks/, NSErrorFailingURLKey=https://example.com/api/tasks/, _NSURLErrorRelatedURLSessionTaskErrorKey=(
"LocalDataTask <090921F1-534C-41EA-BA75-3414966B1425>.<54>"
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <090921F1-534C-41EA-BA75-3414966B1425>.<54>, NSLocalizedDescription=cancelled}
[19/5/2024, 12:20 AM] [API] Unable to load tasks: Error Domain=NSURLErrorDomain Code=-999 UserInfo={NSErrorFailingURLStringKey=, NSErrorFailingURLKey=, _NSURLErrorRelatedURLSessionTaskErrorKey=, _NSURLErrorFailingURLSessionTaskErrorKey=, NSLocalizedDescription=}
[19/5/2024, 12:20 AM] [General] Unable to decode date from string: 2024-05-13T23:38:29.836162Z
[19/5/2024, 12:20 AM] [API] Unable to load tasks: Error Domain=swift_paperless.DateDecodingError Code=0
[19/5/2024, 12:20 AM] [General] Requesting log export

@hermanmak
Copy link
Author

Was my logs enough to debug?

@paulgessinger
Copy link
Owner

paulgessinger commented May 30, 2024

I haven't figured it out yet.
It seems to be hitting my custom date parsing chain, but this format should be supported and works in my test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants