Discourse solved plugin throwing 500 error

AI-generated summary

Users Caliph and Hotfirenet reported a 500 error when marking replies as solved after upgrading Discourse, traced to an ArgumentError (unknown keyword: duration) in topic.rb. The issue stemmed from using the stable branch, which lacked a recent plugin update adding the duration parameter. Caliph identified the mismatch and opted to wait for the stable branch to catch up. Hotfirenet confirmed the same error and was advised by itsbhanusharma to switch to the tests-passed branch for newer features and fixes. kris.kotlarek later pushed a fix to the discourse-solved plugin, which Hotfirenet confirmed resolved the issue. Testing in safe mode ruled out conflicts with unofficial plugins or themes. The consensus is that tests-passed is recommended for production over stable for up-to-date functionality.

I recently upgraded my discourse version and all of my plugins are up to date.
After upgrade I am now getting 500 error when trying to mark a reply as solution.

Below are the error details I am getting in console.

    Failed to load resource: the server responded with a status of 500 ()
_application-ed0ac69…88e883e0db.js:11141 SyntaxError: Unexpected token < in JSON at position 0
    at Function.parse [as parseJSON] (<anonymous>)
    at n (_application-ed0ac69…88e883e0db.js:11137)
    at e.popupAjaxError (_application-ed0ac69…88e883e0db.js:11180)
    at E (ember_jquery-8e338e1…8f98e499a037a9.js:1)
    at w (ember_jquery-8e338e1…8f98e499a037a9.js:1)
    at g (ember_jquery-8e338e1…8f98e499a037a9.js:1)
    at t.invoke (ember_jquery-8e338e1…8f98e499a037a9.js:1)
    at e.t.flush (ember_jquery-8e338e1…8f98e499a037a9.js:1)
    at e.t.flush (ember_jquery-8e338e1…8f98e499a037a9.js:1)
    at e.t._end (ember_jquery-8e338e1…8f98e499a037a9.js:1)
ember_jquery-8e338e1…8f98e499a037a9.js:1 Uncaught 
Object
jqXHR: {readyState: 4, getResponseHeader: ƒ, getAllResponseHeaders: ƒ, setRequestHeader: ƒ, overrideMimeType: ƒ, …}
textStatus: "error"
errorThrown: ""
_discourse_displayed: true
__proto__: Object

do you have unofficial plugins installed? Is it working in safe mode with only official plugins and themes?

Yes I do have unofficial plugin installed and I haven’t checked in safemode (I dont know how to do it :noobface:)

Though I checked logs and it showed this
ArgumentError (unknown keyword: duration) /var/www/discourse/app/models/topic.rb:1138:in 'set_or_create_timer'
(Backtrace if you’re interested: https://pastebin.com/chKtDTeL.)

Then I went to solved settings and set auto close hours to 0 (Previous value 72) and it works now but I really want to use this feature. Any help?

just go to /safe-mode on your site to access safe mode settings. Looks like this:

Ok someone from my team has tried this already
· Disabling unofficial plugins (e.g. our badges plugin) did not resolve the issue.
· Disabling our theme (e.g. custom JavaScript) did not resolve the issue.
· Disabling unofficial plugins and theme together did not resolve the issue.
Using safe-mode.

Didn’t try disabling all plugin cause you know it will disable solved also :grin:

do you have any pavilion plugins?

It seems related to what I found in logs. Last update made by plugin author is this
https://github.com/discourse/discourse-solved/commit/329d8aff30bf21e59e2c2ddcbc0e5a51bc8ef70d

No plugins from pavilion

I just updated my personal site to latest and enabled the solved plugin, and it works fine for me. I am not able to replicate.

I think I got the issue. We are on stable release (Not the default tests-passed) which doesn’t have the ‘duration’ change yet.

Thankyou for looking into it, really appreciate it! I think we will just wait until the stable branch is updated to use this feature.

Hello i have the same problem:

Discourse version:

My extensions:

I have try in safe mode, it’s same.

The log
image

Message

ArgumentError (unknown keyword: duration)
/var/www/discourse/app/models/topic.rb:1138:in `set_or_create_timer'

Backtrace

/var/www/discourse/app/models/topic.rb:1138:in `set_or_create_timer'
/var/www/discourse/plugins/discourse-solved/plugin.rb:126:in `accept_answer!'
/var/www/discourse/plugins/discourse-solved/plugin.rb:206:in `accept'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/actionpack-6.0.1/lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/actionpack-6.0.1/lib/abstract_controller/base.rb:196:in `process_action'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/actionpack-6.0.1/lib/action_controller/metal/rendering.rb:30:in `process_action'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/actionpack-6.0.1/lib/abstract_controller/callbacks.rb:42:in `block in process_action'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/callbacks.rb:135:in `run_callbacks'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/actionpack-6.0.1/lib/abstract_controller/callbacks.rb:41:in `process_action'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/actionpack-6.0.1/lib/action_controller/metal/rescue.rb:22:in `process_action'

Thanks for your help

Hello evorybody,
Have toi for an Idea ?

You’re on a specific discourse version which probably doesn’t have the feature backported. The solved plugin works fine with latest tests-passed branch so consider upgrading to that.

why ?
I 'm un stable version.

So if i understand, stable version is not a good version for discourse production server ???

  ## Which Git revision should this container use? (default: tests-passed)
  version: stable

It is Good but generally very very old and lacking new features. You should really be using tests-passed as it’s stable enough and contains all new features and performance improvements.

ok thanks for your response.

I made a fix yesterday. Could you update discourse-solved plugin and confirm if the issue is solved for you?

Hello @kris.kotlarek,
that’s good for me with this version:

Thanks