All of my custom report mail_report jobs give this error, both through cron and when triggered manually:
"Did not find valid instance to execute"
The report is defined as
class com_foo_bar extends CRM_Report_Form {
It is stored as an extension in
[civicrm.files]/ext/custom
For example, report 70 works fine in a webbrowser .. it is at
https://mydomain.com/bla/civicrm/report/instance/70
But the mail_report job log says
Entity: Job Action: mail_report Summary Finished execution of yyy with result: Failure, Error message: Report Mail Triggered... Did not find valid instance to execute Details
Parameters raw (from db settings): instanceId=70 format=csv
Parameters parsed (and passed to API method): a:3:{s:7:"version";i:3;s:10:"instanceId";s:2:"70";s:6:"format";s:3:"csv";}
Full message: Finished execution of yyy with result: Failure, Error message: Report Mail Triggered... Did not find valid instance to execute
The same happens when called from the command line. If job.mail_report is called on a regular report, it returns results. But if it is called on my custom reports, it returns
$ drush -u cron civicrm-api job.mail_report instanceId=70 format=csv sendmail=0
Report Mail Triggered... [error]
Did not find valid instance to execute
Array
(
[is_error] => 1
[error_message] => Report Mail Triggered...
Did not find valid instance to execute
)
or
$ php bin/cli.php -s mydomain.com -u cron -p XXXXXX -e Job -a mail_report --instanceId=70 --format=csv --sendmail=0
Report Mail Triggered...
Did not find valid instance to execute
Died during callApi
Any ideas ?