toddsundsted/ktistec

Potential unhandled exception in JSON processing

Opened this issue · 2 comments

Observed this exception in the logs. It is not clear which message caused this though.

2024-11-09 05:36:42 UTC 200 GET /objects/hxWiJIe2XC4/remote-like 12.76ms                                                                                    
Exception: Cast from String to Array(T) failed, at /data/crystal-1.10.1-1/share/crystal/src/json/any.cr:262:5:262 (TypeCastError)                           
  from /data/crystal-1.10.1-1/share/crystal/src/json/any.cr:261:3 in 'as_a'                                                                                 
  from /data/rgop2232/ktistec-2.3.0/src/models/activity_pub/collection.cr:117:9 in 'map_items'                                                              
  from /data/rgop2232/ktistec-2.3.0/src/models/activity_pub/collection.cr:135:11 in 'map:default'                                                           
  from /data/rgop2232/ktistec-2.3.0/src/models/activity_pub.cr:13:5 in 'from_json_ld:default'                                                               
  from /data/rgop2232/ktistec-2.3.0/src/models/activity_pub/collection.cr:25:5 in 'from_json_ld'                                                            
  from /data/rgop2232/ktistec-2.3.0/src/models/activity_pub/collection.cr:141:11 in 'map:default'                                                           
  from /data/rgop2232/ktistec-2.3.0/src/models/activity_pub.cr:13:5 in 'from_json_ld:default'                                                               
  from /data/rgop2232/ktistec-2.3.0/src/models/activity_pub/collection.cr:25:5 in 'from_json_ld'                                                            
  from /data/rgop2232/ktistec-2.3.0/src/models/activity_pub/object.cr:701:11 in 'map'                                                                       
  from /data/rgop2232/ktistec-2.3.0/src/models/activity_pub.cr:13:5 in 'from_json_ld'                                                                       
  from /data/rgop2232/ktistec-2.3.0/src/models/activity_pub/activity.cr:96:11 in 'map:default'                                                              
  from /data/rgop2232/ktistec-2.3.0/src/models/activity_pub.cr:13:5 in 'from_json_ld:default'                                                               
  from /data/rgop2232/ktistec-2.3.0/src/models/activity_pub/activity.cr:26:5 in 'from_json_ld'                                                              
  from /data/rgop2232/ktistec-2.3.0/src/controllers/inboxes.cr:30:9 in '->'                                                                                 
  from /data/rgop2232/ktistec-2.3.0/lib/kemal/src/kemal/route.cr:12:26 in '->'                                                                              
  from /data/rgop2232/ktistec-2.3.0/lib/kemal/src/kemal/route_handler.cr:52:39 in 'process_request'                                                         
  from /data/rgop2232/ktistec-2.3.0/lib/kemal/src/kemal/route_handler.cr:17:7 in 'call'                                                                     
  from /data/crystal-1.10.1-1/share/crystal/src/http/server/handler.cr:30:7 in 'call_next'                                                                  
  from /data/rgop2232/ktistec-2.3.0/lib/kemal/src/kemal/websocket_handler.cr:13:14 in 'call'                                                                
  from /data/crystal-1.10.1-1/share/crystal/src/http/server/handler.cr:30:7 in 'call_next'                                                                  
  from /data/rgop2232/ktistec-2.3.0/src/handlers/canonical.cr:15:14 in 'call'                                                                               
  from /data/crystal-1.10.1-1/share/crystal/src/http/server/handler.cr:30:7 in 'call_next'                                                                  
  from /data/rgop2232/ktistec-2.3.0/src/framework/rewrite.cr:8:14 in 'call'                                                                                 
  from /data/crystal-1.10.1-1/share/crystal/src/http/server/handler.cr:30:7 in 'call_next'                                                                  
  from /data/rgop2232/ktistec-2.3.0/src/framework/method.cr:21:14 in 'call'                                                                                 
  from /data/crystal-1.10.1-1/share/crystal/src/http/server/handler.cr:30:7 in 'call_next'                                                                  
  from /data/rgop2232/ktistec-2.3.0/src/framework/csrf.cr:49:14 in 'call'                                                                                   
  from /data/crystal-1.10.1-1/share/crystal/src/http/server/handler.cr:30:7 in 'call_next'                                                                  
  from /data/rgop2232/ktistec-2.3.0/src/framework/auth.cr:13:14 in 'call'                                                                                   
  from /data/crystal-1.10.1-1/share/crystal/src/http/server/handler.cr:30:7 in 'call_next'                                                                  
  from /data/rgop2232/ktistec-2.3.0/lib/kemal/src/kemal/static_file_handler.cr:11:11 in 'call'                                                              
  from /data/crystal-1.10.1-1/share/crystal/src/http/server/handler.cr:30:7 in 'call_next'                                                                  
  from /data/rgop2232/ktistec-2.3.0/lib/kemal/src/kemal/exception_handler.cr:8:7 in 'call'                                                                  
  from /data/crystal-1.10.1-1/share/crystal/src/http/server/handler.cr:30:7 in 'call_next'                                                                  
  from /data/rgop2232/ktistec-2.3.0/lib/kemal/src/kemal/head_request_handler.cr:57:7 in 'call'                                                              
  from /data/crystal-1.10.1-1/share/crystal/src/http/server/handler.cr:30:7 in 'call_next'                                                                  
  from /data/crystal-1.10.1-1/share/crystal/src/time.cr:357:5 in 'call'                                                                                     
  from /data/crystal-1.10.1-1/share/crystal/src/http/server/handler.cr:30:7 in 'call_next'                                                                  
  from /data/rgop2232/ktistec-2.3.0/lib/kemal/src/kemal/init_handler.cr:15:7 in 'call'                                                                      
  from /data/crystal-1.10.1-1/share/crystal/src/http/server/request_processor.cr:51:11 in 'process'                                                         
  from /data/crystal-1.10.1-1/share/crystal/src/http/server.cr:521:5 in 'handle_client'                                                                     
  from /data/crystal-1.10.1-1/share/crystal/src/http/server.cr:451:5 in '->'                                                                                
  from /data/crystal-1.10.1-1/share/crystal/src/fiber.cr:146:11 in 'run'                                                                                    
  from /data/crystal-1.10.1-1/share/crystal/src/fiber.cr:98:34 in '->'                                                                                      
  from ???                             

i haven't seen this one in my logs. it looks like someone sent an activity/object to your inbox with a collection that consisted of a string instead of an array of strings.

i'd like to get a look at this message. do you see this in the logs on a regular basis and can you tell where it's coming from? i can easily modify the code to just throw this away, but i'd like to handle it correctly if possible.

the error itself isn't a problem with the server, however.

I quickly checked my logs now. I do not see it in the recent logs. I will keep a watch for it, and update it here if I find this again.