# Fout in taak: undefined method \`cancel\_scheduled\_job' for Jobs::Jobs:Module

**URL:** https://meta.discourse.org/t/failing-job-undefined-method-cancel-scheduled-job-for-jobs-module/228155
**Category:** Development
**Created:** [26 mei 2022 om 09:07 UTC](https://meta.discourse.org/t/failing-job-undefined-method-cancel-scheduled-job-for-jobs-module/228155 "2022-05-26T09:07:07Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [26 mei 2022 om 09:07 UTC](https://meta.discourse.org/t/failing-job-undefined-method-cancel-scheduled-job-for-jobs-module/228155/1 "2022-05-26T09:07:07Z")

</div>

during `Jobs::ProcessPost`

I can recreate on command line:

 ![image](https://global.discourse-cdn.com/meta/original/4X/0/2/4/02487b9878be0aef44b9f6e0a7c74b4d93905044.jpeg)

whereas I can successfully reach it by:

 ![image](https://global.discourse-cdn.com/meta/original/4X/c/9/9/c999993ae3cc1e860c4403b8c329e437e61a4928.jpeg)

Believe it might be related to this:

[https://github.com/discourse/discourse/commit/bf6f8299a781922737fa01c408078f4c090885b6](https://github.com/discourse/discourse/commit/bf6f8299a781922737fa01c408078f4c090885b6)

Contains:

> <https://github.com/discourse/discourse/blob/bf6f8299a781922737fa01c408078f4c090885b6/app/jobs/regular/process_post.rb#L67>

In this context, could it require a leading `::`?

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [26 mei 2022 om 11:35 UTC](https://meta.discourse.org/t/failing-job-undefined-method-cancel-scheduled-job-for-jobs-module/228155/2 "2022-05-26T11:35:59Z")

</div>

Hmm, adding a leading `::` would certainly fix it… but it shouldn’t be required 🤔

Given that the call comes from within `::Jobs::ProcessPost`, Ruby should work up the tree. First it’ll look for `::Jobs::ProcessPost::Jobs`, then `::Jobs::Jobs`, then eventually `::Jobs` module.

The error you’re seeing suggests that something is defining `::Jobs::Jobs`… which is weird! Taking a look on my development instance:

```plaintext
[1] pry(main)> Jobs::Jobs
=> Jobs::Jobs
[2] pry(main)> Jobs::Jobs.constants
=> [:RemapOldBotImages, :GrantBadges]

```

🤯

Looks like these lines in discourse-narrative-bot are causing issues. If I comment them out, it solves the problem.

> <https://github.com/discourse/discourse/blob/aabbc9e63e22a141edc527050281384cfe648e21/plugins/discourse-narrative-bot/plugin.rb#L13-L23>

Good news is that it’s development-only - related to the file paths of the jobs mismatching the names of the modules. Here’s a PR to clean things up:

[https://github.com/discourse/discourse/pull/16924](https://github.com/discourse/discourse/pull/16924)

Thanks for the report @merefield

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [26 mei 2022 om 11:41 UTC](https://meta.discourse.org/t/failing-job-undefined-method-cancel-scheduled-job-for-jobs-module/228155/3 "2022-05-26T11:41:12Z")

</div>

Ah, yes, weird and explains why Production didn’t blow up!

Thanks for speedy response!!

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [27 mei 2022 om 07:00 UTC](https://meta.discourse.org/t/failing-job-undefined-method-cancel-scheduled-job-for-jobs-module/228155/4 "2022-05-27T07:00:32Z")

</div>

This topic was automatically closed after 17 hours. New replies are no longer allowed.
