Fixing missing remote avatars

I set up my instance a few days ago, and mostly it is running smoothly. However, a small number of remote/federated user avatars didn’t get pulled over/are showing as the default.

Here are the things I’ve tried to fix these accounts:

  • Unfollowed and re-followed.
  • Had a remote user upload a new avatar to the remote instance
  • The “refresh avatar” button for the user in the moderator/accounts panel.
  • Used the rake redownload_avatars task. No obvious errors, but truthfully I didn’t scrutinize all of its voluminous output.

Most of the remote accounts’ avatars show up fine. Two of these accounts are located on, and one is another instance I forget which.

Suggestions for what to try next are welcome. I’m starting to think the solution will involve digging into SQL.


1 Like

Okay I’m going to bump my own thread; sorry.

Looking at /public/system/accounts/avatars/000/000/ the directories for these users didn’t exist. And running the redownload_avatars task skips them, even after I created the appropriate directories. So I feel like there must be something wrong with their database entries that none of the available tools I can find can easily fix.

I straight up used the rails console command to delete the entry for the remote user: Account.destroy(account_id)

Then I refollowed the remote user, and … the remote user gets a new account_id, but still no avatar.

I’m at a complete loss. Remote users without avatars are on and (but plenty of other users from are working). Am I going to have to just start my database from scratch?

I have no idea here. I tried to research similar problems but got discourage in almost total lack of debug logging in the API routines…

Thanks for the reply, at least. Whenever I figure this out I’ll post here. It’s frustrating that this very small but glaring and pernicious snafu is taking my attention away from other ways I could improve my instance. It feels like I have to have expertise in every layer of the application to diagnose and fix this problem (is it postgres? is it rails? is it sidekiq?), which isn’t very “anyone can run their own instance.”

For people who might run into this in the future, I figured out the right combination of manual commands to fix this problem. In this case, the avatar_remote_url field was set to nul and none of the other tools to refresh remote avatars would populate the field, instead the account was just skipped.

Here are the steps I performed to get the remote avatars. Might have to do a similar thing for remote headers as well, so far the accounts this happened to for me didn’t have headers.

cd ~live
RAILS_ENV=production bundle exec rails c
a = Account.find_remote('USERNAME', 'REMOTE.DOMAIN')
a.avatar_remote_url = "https://url/to_remote_avatar.png"

To get the remote_url of the avatar, I went to the user’s profile on the remote domain and poked around in the web console.


Wow. Thanks a bunch! This was a lifesaver for one issue I’ve been experiencing. My issue with avatars wasn’t exactly like yours where the remote_url wasn’t populated but instead where it thought I had a cached file that actually wasn’t there, so if anyone else is having the same issue as me you can do pretty much what the mastodon:media:redownload_avatars rake command is supposed to do but doesn’t manually:

cd ~/live
RAILS_ENV=production bundle exec rails c
a = Account.find_remote('USERNAME', 'REMOTE.DOMAIN')