| name | cloud-scheduler-permission-denied |
| description | Fix Google Cloud Scheduler silently failing to trigger Cloud Run jobs with status code 7
(PERMISSION_DENIED). Use when: (1) Cloud Run jobs stop running but schedulers show ENABLED,
(2) gcloud scheduler jobs describe shows lastAttemptTime but status.code: 7,
(3) Jobs worked before but stopped after IAM changes or project updates.
The scheduler service account needs roles/run.invoker on the project.
|
| author | Claude Code |
| version | 1.0.0 |
| date | "2026-02-08T00:00:00.000Z" |
Cloud Scheduler Permission Denied (Code 7)
Problem
Cloud Scheduler jobs silently fail to trigger Cloud Run jobs. The scheduler shows as
ENABLED, attempts are made (lastAttemptTime updates), but Cloud Run jobs never start.
The only indicator is status.code: 7 which means PERMISSION_DENIED.
Context / Trigger Conditions
Solution
-
Identify the scheduler's service account:
gcloud scheduler jobs describe <scheduler-name> \
--location=<region> \
--project=<project> \
--format="yaml(httpTarget.oauthToken.serviceAccountEmail)"
-
Grant run.invoker role to that service account:
gcloud projects add-iam-policy-binding <project-id> \
--member="serviceAccount:<service-account-email>" \
--role="roles/run.invoker"
-
Test by manually triggering the scheduler:
gcloud scheduler jobs run <scheduler-name> \
--location=<region> \
--project=<project>
-
Verify the Cloud Run job started:
gcloud run jobs executions list \
--region=<region> \
--project=<project> \
--limit=5
Verification
After granting permissions and triggering:
status.code should no longer be 7 on next attempt
- New Cloud Run job execution should appear in executions list
- Execution should show RUNNING status
Example
gcloud scheduler jobs describe profile-crawler-schedule \
--location=us-central1 \
--project=my-project
gcloud projects add-iam-policy-binding my-project \
--member="serviceAccount:my-scheduler@my-project.iam.gserviceaccount.com" \
--role="roles/run.invoker"
gcloud scheduler jobs run profile-crawler-schedule \
--location=us-central1 \
--project=my-project
Notes
- Status code 7 is gRPC's PERMISSION_DENIED - not documented prominently for Cloud Scheduler
- This commonly happens after:
- Creating new service accounts
- Migrating projects
- IAM policy updates that remove inherited permissions
- Using a custom service account instead of the default
- The scheduler will keep attempting (and failing) silently - no alerts by default
- Consider adding Cloud Monitoring alerts for scheduler failures
References