Server Error 500 on Admin / Dashboard

Getting Server Error 500 on Admin / Dashboard.

here is the error in the /logs

Any ideas? I had this last week but an app rebuild fixed it. (I will do that but I wanted to see if anyone else saw this)

You should simply get latest and rebuild first.


I am still getting this error on my dashboard
{“status”:500,“error”:“Internal Server Error”}
Can anybody help?

Thanks in advance!!

From the SSH command line, get latest and rebuild.

cd /var/discourse
./launcher rebuild app

I have deployed without docker. so there is no ./ launcher. I simply deploy with capistrano 3. I am also using multisite.
Can you please help me out for this?

No, we only support the docker install here, as stated many places, many times.

I have solved the above problem. Can anyone help with this ?

I am getting this error for admin dashboard.

Thanks in advance !!

Hello @vaibhavclecotech :slight_smile:

I think, I can help you with this.

class AdminDashboardGeneralData < AdminDashboardData
  def get_json
    days_since_update = (( - Discourse.last_commit_date) /
      discourse_updated_at: Discourse.last_commit_date,
      release_notes_link: "{days_since_update}"

As per my understanding on Discourse,
you should be getting error because of this line


If you will run this command in your production rails console. you will see the error mentioned below.

irb(main):002:0> Discourse.last_commit_date
fatal: not a git repository (or any of the parent directories): .git

I think, you are just using the Cap deployment script for you deployment purpose. Obviously, it never stores the git commits etc. at the server so you will always get error while accessing /admin/dashboard/general.json

You are using Discourse.last_commit_date and it is looking for the date of the last commit but it’s not possible with cap deployment.

Don’t worry, I can even help you fixing this problem:
FYI: It’s just to solve your issue :slight_smile: Frankly speaking, I don’t like overriding main features.

  • There is a method calls as self.last_commit_date with in the lib/discourse.rb file.
  • You should also know that Cap deployment always stores releases folders with in the releases folder. i.e 20190529092722
  • So, you just need to override the self.last_commit_date method simply and need to extract the time string from the latest release folder ( You can just read the name of all the folders of releases directory and you can sort it easily to find out the latest time string )
  • You can now use this latest release time string as a return with in your self.last_commit_date method.

You can also use Rails.root.to_s, it will give you the path of latest release folder :smiley: [Tricky :stuck_out_tongue: ] and you can follow the way I am showing you below

irb(main):041:0> Rails.root.to_s
=> "/home/deploy/projectname/releases/20190529092722"
irb(main):042:0> latest_deployment=Rails.root.to_s.split("/").last
=> "20190529092722"
irb(main):043:0> DateTime.parse(latest_deployment)
=> Wed, 29 May 2019 09:27:22 +0000


  def self.last_commit_date
    $last_commit_date ||=
        git_cmd = 'git log -1 --format="%ct"'
        seconds = self.try_git(git_cmd, nil)
        seconds.nil? ? nil : DateTime.strptime(seconds, '%s')

You can fix it by creating one file within initializers folder and writing the below mentioned code [:smiley: ]:

  def last_commit_date
    $last_commit_date ||=

Thanks :slight_smile:


Thank you very much @ashishprajapati,

I checked and its working very smoothly :slight_smile:
You saved my day.

1 Like