# Automation script Schedule PM with Data Explorer results not sending PMs

**URL:** <https://meta.discourse.org/t/automation-script-schedule-pm-with-data-explorer-results-not-sending-pms/269135>\
**Category:** Bug\
**Tags:** automation\
**Created:** [June 21, 2023, 9:46am UTC](https://meta.discourse.org/t/automation-script-schedule-pm-with-data-explorer-results-not-sending-pms/269135 "2023-06-21T09:46:11Z")\
**Posts on this page:** 1\
**Showing post:** 21

<div class="post-metadata">

**Author:** ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)\
**Post date:** [June 23, 2023, 1:04pm UTC](https://meta.discourse.org/t/automation-script-schedule-pm-with-data-explorer-results-not-sending-pms/269135/21 "2023-06-23T13:04:52Z")

</div>

As for me, it seems I can’t get a successful trigger of this automation script, whatever the [data explorer](https://meta.discourse.org/t/32566?silent=true) query is. For example:

```sql
SELECT username from users
LIMIT 10

```

 ![image](https://global.discourse-cdn.com/meta/original/4X/2/4/e/24e3d574c3a49b12acc763267425856c00f1abdc.png)

Error 500 when I manually trigger from Automation:

 ![image](https://global.discourse-cdn.com/meta/original/4X/c/3/8/c384efb5230699a6c7a0b77a1e095e8e7688aa86.png)

```plaintext
Message (3 copies reported)

TypeError (Nil is not a valid JSON source.)
app/controllers/application_controller.rb:418:in `block in with_resolved_locale'
app/controllers/application_controller.rb:418:in `with_resolved_locale'
lib/middleware/omniauth_bypass_middleware.rb:74:in `call'
lib/content_security_policy/middleware.rb:12:in `call'
lib/middleware/anonymous_cache.rb:369:in `call'
config/initializers/100-quiet_logger.rb:20:in `call'
config/initializers/100-silence_logger.rb:29:in `call'
lib/middleware/enforce_hostname.rb:24:in `call'
lib/middleware/request_tracker.rb:228:in `call'

Backtrace

plugins/discourse-data-explorer/lib/report_generator.rb:42:in `parse'
plugins/discourse-data-explorer/lib/report_generator.rb:42:in `params_to_hash'
plugins/discourse-data-explorer/lib/report_generator.rb:15:in `generate'
plugins/discourse-data-explorer/plugin.rb:117:in `block (4 levels) in activate!'
plugins/discourse-automation/app/models/discourse_automation/automation.rb:83:in `trigger!'
plugins/discourse-automation/app/controllers/discourse_automation/automations_controller.rb:10:in `trigger'
actionpack (7.0.4.3) lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
actionpack (7.0.4.3) lib/abstract_controller/base.rb:215:in `process_action'
actionpack (7.0.4.3) lib/action_controller/metal/rendering.rb:53:in `process_action'
actionpack (7.0.4.3) lib/abstract_controller/callbacks.rb:234:in `block in process_action'

Env

HTTP HOSTS: discourse.canapin.dev

```

---

_[View the full topic](https://meta.discourse.org/t/automation-script-schedule-pm-with-data-explorer-results-not-sending-pms/269135)._
