API returns 500 error: NoMethodError (undefined method `thumbnail_remote_url'

I can successfully log in on my mastodon instance. But when I visit the timeline page, it doesn’t show the content and gives me several 500 errors.
Several days ago I tried to visit the mastodon, which had been successfully installed on my server previously. I found it broken and checked my server, and fixed the nginx which somehow broken down. After that I also found out two of the three mastodon services broke down. I redid the installation process and managed to make them running. I asummed the problem might been fixed, but got the result discribed at the beginning. I had updated the server system to Ubuntu 20.04.1 about a week ago. I’m not sure whether this is related to the problem.

These are the URLs that returns 500 error (even when I visit them locally on the server, which means it might not be nginx’s fault):

> xhr.js:175 GET https://mastodon.haku.site/api/v1/timelines/home 500
> xhr.js:175 GET https://mastodon.haku.site/api/v1/timelines/public?local=true&only_media=false 500
> xhr.js:175 GET https://mastodon.haku.site/api/v1/timelines/public?remote=true&only_media=false 500
> xhr.js:175 GET https://mastodon.haku.site/api/v1/accounts/relationships?id[]=4313&id[]=3 500

These are what I got by running journalctl -u mastodon-web after visiting the timeline page.

> Oct 06 11:36:37 ip-172-31-3-35 bundle[72931]: [175b68c8-0fd9-4eee-917b-b15cb0ff2fa7] method=GET path=/api/v1/timelines/home format=*/* controller=Api::V1::Timelines::HomeController action=show status=301 duration=0.61 view=0.00 db=0.00 location=https://localhost/api/v1/timelines/home
> Oct 06 11:39:02 ip-172-31-3-35 bundle[72931]: [7fb497d9-fd4c-49d0-babe-bdc3bb710edf] method=GET path=/api/v1/timelines/home format=*/* controller=Api::V1::Timelines::HomeController action=show status=500 error='NoMethodError: undefined method `thumbnail_remote_url' for #<MediaAttachment:0x000055e0a503ec48>
> Oct 06 11:39:02 ip-172-31-3-35 bundle[72931]: Did you mean?  thumbnail_remote_url=' duration=2513.87 view=0.00 db=121.01
> Oct 06 11:39:02 ip-172-31-3-35 bundle[72931]: [7fb497d9-fd4c-49d0-babe-bdc3bb710edf]
> Oct 06 11:39:02 ip-172-31-3-35 bundle[72931]: [7fb497d9-fd4c-49d0-babe-bdc3bb710edf] NoMethodError (undefined method `thumbnail_remote_url' for #<MediaAttachment:0x000055e0a503ec48>
> Oct 06 11:39:02 ip-172-31-3-35 bundle[72931]: Did you mean?  thumbnail_remote_url=):
> Oct 06 11:39:02 ip-172-31-3-35 bundle[72931]: [7fb497d9-fd4c-49d0-babe-bdc3bb710edf]
> Oct 06 11:39:02 ip-172-31-3-35 bundle[72931]: [7fb497d9-fd4c-49d0-babe-bdc3bb710edf] app/serializers/rest/media_attachment_serializer.rb:39:in `preview_remote_url'
> Oct 06 11:39:02 ip-172-31-3-35 bundle[72931]: [7fb497d9-fd4c-49d0-babe-bdc3bb710edf] app/controllers/api/v1/timelines/home_controller.rb:11:in `show'
> Oct 06 11:39:16 ip-172-31-3-35 bundle[72931]: [20d84430-7ea7-47f4-8510-84ea3169b7bb] method=POST path=/inbox format=html controller=ActivityPub::InboxesController action=create status=202 duration=3.80 view=0.00 db=1.88 key=https://mathstodon.xyz/users/andriaustinusa#main-key
> Oct 06 11:40:04 ip-172-31-3-35 bundle[72930]: [2293123d-b271-4811-92fd-1fed034c7933] method=POST path=/inbox format=html controller=ActivityPub::InboxesController action=create status=202 duration=39.07 view=0.00 db=20.23 key=https://mstdn.io/users/andielias#main-key
> root@ip-172-31-3-35:/home/haku# journalctl -u mastodon-web | grep -v "well-known" | grep -v "nodeinfo" | grep -v "pocp" | grep -v "statistics" | grep -v friendi | tail -20
> Oct 06 11:45:52 ip-172-31-3-35 bundle[72931]: LINE 8:                WHERE a.attrelid = '"account_notes"'::regclas...
> Oct 06 11:45:52 ip-172-31-3-35 bundle[72931]:                                           ^
> Oct 06 11:45:52 ip-172-31-3-35 bundle[72931]: :               SELECT a.attname, format_type(a.atttypid, a.atttypmod),
> Oct 06 11:45:52 ip-172-31-3-35 bundle[72931]:                      pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod,
> Oct 06 11:45:52 ip-172-31-3-35 bundle[72931]:                      c.collname, col_description(a.attrelid, a.attnum) AS comment
> Oct 06 11:45:52 ip-172-31-3-35 bundle[72931]:                 FROM pg_attribute a
> Oct 06 11:45:52 ip-172-31-3-35 bundle[72931]:                 LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum
> Oct 06 11:45:52 ip-172-31-3-35 bundle[72931]:                 LEFT JOIN pg_type t ON a.atttypid = t.oid
> Oct 06 11:45:52 ip-172-31-3-35 bundle[72931]:                 LEFT JOIN pg_collation c ON a.attcollation = c.oid AND a.attcollation <> t.typcollation
> Oct 06 11:45:52 ip-172-31-3-35 bundle[72931]:                WHERE a.attrelid = '"account_notes"'::regclass
> Oct 06 11:45:52 ip-172-31-3-35 bundle[72931]:                  AND a.attnum > 0 AND NOT a.attisdropped
> Oct 06 11:45:52 ip-172-31-3-35 bundle[72931]:                ORDER BY a.attnum
> Oct 06 11:45:52 ip-172-31-3-35 bundle[72931]: ):
> Oct 06 11:45:52 ip-172-31-3-35 bundle[72931]: [75ea087d-a240-454b-a509-aa1926ea71c6]
> Oct 06 11:45:52 ip-172-31-3-35 bundle[72931]: [75ea087d-a240-454b-a509-aa1926ea71c6] app/models/concerns/account_interactions.rb:48:in `account_note_map'
> Oct 06 11:45:52 ip-172-31-3-35 bundle[72931]: [75ea087d-a240-454b-a509-aa1926ea71c6] app/presenters/account_relationships_presenter.rb:20:in `initialize'
> Oct 06 11:45:52 ip-172-31-3-35 bundle[72931]: [75ea087d-a240-454b-a509-aa1926ea71c6] app/controllers/api/v1/accounts/relationships_controller.rb:18:in `new'
> Oct 06 11:45:52 ip-172-31-3-35 bundle[72931]: [75ea087d-a240-454b-a509-aa1926ea71c6] app/controllers/api/v1/accounts/relationships_controller.rb:18:in `relationships'
> Oct 06 11:45:52 ip-172-31-3-35 bundle[72931]: [75ea087d-a240-454b-a509-aa1926ea71c6] app/controllers/api/v1/accounts/relationships_controller.rb:12:in `index'
> Oct 06 11:45:52 ip-172-31-3-35 bundle[72930]: [6f023753-1312-44a1-8b44-1c6461046622] method=GET path=/manifest.json format=json controller=ManifestsController action=show status=200 duration=40.45 view=35.60 db=1.98

What should I check to fix the problem?

Can you post some details of an SQL error you have in the second log?

Somehow you have managed to partially upgrade your instance - it was not a good move to just “reinstall” (possibly a newer version) on top of the old one. Restore from the backup and let us know about the older problems if they still persist. If you can’t, just try to walk through Mastodon upgrade instructions, most importantly you need to run database migrations.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.