# CRON error (no such table: cache\_locks) but app works?

**URL:** <https://community.fly.io/t/cron-error-no-such-table-cache-locks-but-app-works/21329>\
**Category:** General\
**Tags:** sqlite, volumes, login-only\
**Created:** [August 14, 2024, 2:19pm UTC](https://community.fly.io/t/cron-error-no-such-table-cache-locks-but-app-works/21329 "2024-08-14T14:19:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mAndreG](https://avatars.discourse-cdn.com/v4/letter/m/e68b1a/32.png) [@mAndreG](https://community.fly.io/u/mAndreG)\
**Post date:** [August 14, 2024, 2:19pm UTC](https://community.fly.io/t/cron-error-no-such-table-cache-locks-but-app-works/21329/1 "2024-08-14T14:19:23Z")

</div>

Hello, I’ve been struggling with cron since I tried implementing it. I followed the docs and added the “cron -f” line to fly.toml.

However, when I SSH into the machines with `fly ssh console -s` I get the following:  
“app” machine:

```auto
/var/www/html# php artisan schedule:list

  0 9 * * * Closure at: routes/console.php:13 ... Next Due: 18 hours from now

```

“cron” machine:

```auto
var/www/html# php artisan schedule:list
{"message":"SQLSTATE[HY000]: General error: 1 no such table: cache_locks (Connection: sqlite, SQL: update \"cache_locks\" set \"owner\" = qG8p8rBKf3f3v9, \"expiration\" = 1723731362 where \"key\" = laravel_cache_framework/schedule-da39a3ee5ed3255bfef95601890afd80709 and (\"owner\" = qG8UMprBKf3f3v9 or \"expiration\" <= 1723644962))","context":{"exception":{"class":"Illuminate\\Database\\QueryException","message":"SQLSTATE[HY000]: General error: 1 no such table: cache_locks (Connection: sqlite, SQL: update \"cache_locks\" set \"owner\" = qG8UMp8rBKf3f3v9, \"expiration\" = 1723731362 where \"key\" = laravel_cache_framework/schedule-da39a3eef95601890afd80709 and (\"owner\" = qG8UMp8rBKf39 or \"expiration\" <= 1723644962))","code":0,"file":"/var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connection.php:813","previous":{"class":"PDOException","message":"SQLSTATE[HY000]: General error: 1 no such table: cache_locks","code":0,"file":"/var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connection.php:592"}}},"level":400,"level_name":"ERROR","channel":"production","datetime":"2024-08-14T14:16:02.469295+00:00","extra":{}}

In Connection.php line 813:
                                                                               
  SQLSTATE[HY000]: General error: 1 no such table: cache_locks (Connection: s  
  qlite, SQL: update "cache_locks" set "owner" = qG8UBKf3, "expiratio  
  n" = 1723731362 where "key" = laravel_cache_framework/schedule-da39a3ee5e6b  
  4b0d3255bfef95601899 and ("owner" = qG8UMp8rBKf3 or "expiration  
  " <= 1723644962))                                                            
                                                                               

In Connection.php line 592:
                                                                
  SQLSTATE[HY000]: General error: 1 no such table: cache_locks  

```

I can’t find any other issues, so I’m guessing the reason why my scheduled tasks aren’t working is due to this.

Any advice?

---

<div class="post-metadata">

**Author:** ![ashitag](https://avatars.discourse-cdn.com/v4/letter/a/ebca7d/32.png) [@ashitag](https://community.fly.io/u/ashitag)\
**Post date:** [August 20, 2024, 5:12pm UTC](https://community.fly.io/t/cron-error-no-such-table-cache-locks-but-app-works/21329/2 "2024-08-20T17:12:09Z")

</div>

Can you SSH into your ‘cron’ instance and run `ps aux | grep cron` and see if you get a result for ‘cron -f’ ?

when you run `cron -f` command it essentially looks for a directory like `etc/cron.d/` and loads cron jobs defined in this location.

Uploading your Dockerfile would help in understanding if there’s any issue.  
You might find solutions in this post to be useful-[Laravel Scheduler Cron Not Working](https://community.fly.io/t/laravel-scheduler-cron-not-working/8304)

---

<div class="post-metadata">

**Author:** ![mayailurus](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/mayailurus/32/17593_2.png) [@mayailurus](https://community.fly.io/u/mayailurus)\
**Post date:** [August 21, 2024, 12:32am UTC](https://community.fly.io/t/cron-error-no-such-table-cache-locks-but-app-works/21329/3 "2024-08-21T00:32:55Z")

</div>

These are good finds! The specific DBMS itself is also relevant, I think:

> [@mAndreG](#):
>
> ```plaintext
> Connection: sqlite
> 
> ```

With multiple machines, this is more likely to be a misconfiguration than intentional…

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/fly1/original/3X/6/e/6e8955d00cb218e186ebbe3a6ab06fefdce15290.svg) [@system](https://community.fly.io/u/system)\
**Post date:** [August 28, 2024, 12:33am UTC](https://community.fly.io/t/cron-error-no-such-table-cache-locks-but-app-works/21329/4 "2024-08-28T00:33:52Z")

</div>

Closed on August 28, 2024, 12:33am UTC

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
