wrangler rollback command allows you to quickly revert your Worker to a previous version in case of issues. This is useful for emergency rollbacks when a new deployment causes problems.
Positional Arguments
The ID of the Worker Version to rollback to (UUID format). If not specified, Wrangler will automatically find the most recent stable version (one that was previously deployed at 100% traffic).
Options
The name of your Worker. Can also be specified in your configuration file.
The reason for this rollback. Helps document why the rollback was performed.Alias:
-mAutomatically accept defaults to prompts without manual confirmation.Alias:
-yExamples
Automatic Rollback
Rollback to the most recent stable version (automatically determined):- Find the most recent deployment where a single version received 100% of traffic
- Show you the current deployment
- Show you the version it will rollback to
- Ask for confirmation
- Deploy that version to 100% of traffic
Rollback to Specific Version
Rollback to a specific version by ID:Rollback with Message
Document why you’re rolling back:Non-Interactive Rollback
Skip confirmation prompts (useful for automation):Specify Worker Name
Rollback a specific Worker:Workflow
Show current deployment
Wrangler displays your current deployment, showing which versions are receiving traffic and at what percentages.
Find rollback version
If you didn’t specify a version ID, Wrangler searches your deployment history for the most recent stable version (deployed at 100%).
Prompt for message
You’re prompted to enter a reason for the rollback (optional but recommended for audit trail).
Show rollback target
Wrangler displays details of the version you’re rolling back to, including:
- Version ID
- Creation date
- Tag and message annotations
Confirm rollback
You’re asked to confirm that you want to deploy this version to 100% of traffic. This step is skipped if
--yes is used.Handle secret changes
If secrets have changed since the target version was deployed, Wrangler will:
- List the changed secrets
- Ask for additional confirmation
- Optionally proceed with force flag
Automatic Version Selection
When you runwrangler rollback without specifying a version ID, Wrangler automatically selects the most recent “stable” version:
- Fetches your deployment history
- Sorts deployments by creation date (newest first)
- Skips the current deployment (you can’t rollback to what’s already deployed)
- Finds the first deployment where a single version received 100% of traffic
- Uses that version as the rollback target
Secret Handling
If secrets have been modified, Wrangler will:- Attempt the rollback
- Detect that secrets have changed (API returns error code
10220) - Display which secrets have changed
- Ask for confirmation to proceed
- Retry the rollback with a force flag if you confirm
Example
- Proceed: Rollback will use the current secret values (not the values from when the version was created)
- Abort: Cancel the rollback to avoid potential issues
Rolling back does not rollback secret values. The rolled-back version will use the current secret values, not the values that existed when that version was originally deployed.
Important Considerations
What Gets Rolled Back
✅ Does rollback:- Worker code and logic
- Compatibility date and flags
- Script configuration
- Variable bindings
- Traffic routing (to 100%)
- Secret values (uses current secrets)
- Bound resources (KV namespaces, Durable Objects, R2 buckets, D1 databases)
- Resource data/contents
- Routes and custom domains
- Cron schedules
Bound Resources
For example:- If the new version created new KV keys, they remain after rollback
- If the new version modified D1 schema, the schema changes persist
- If the new version wrote data in a new format to Durable Objects, that data remains
Local Development
Rollback only affects production deployments. Your local development environment using
wrangler dev is not affected and will continue using your local code.Related Commands
wrangler deployments status- Check current deployment before rollbackwrangler deployments list- View deployment history to find rollback targetswrangler versions view- Inspect a version before rolling back to itwrangler versions deploy- Alternative to rollback for gradual traffic shifts
Common Scenarios
Emergency Rollback
When you discover a critical issue in production:Rollback After Failed Gradual Deployment
If a gradual rollout reveals issues:Planned Rollback
For testing or planned maintenance:Rollback with Changed Secrets
When secrets have changed:Best Practices
Always include a rollback message
Always include a rollback message
Document why you’re rolling back:This creates an audit trail visible in
wrangler deployments list.Verify the version before rolling back
Verify the version before rolling back
Check version details before rollback:
Monitor metrics after rollback
Monitor metrics after rollback
Confirm the rollback resolved the issue:
- Check error rates
- Monitor latency
- Verify traffic patterns
Consider gradual rollback for non-critical issues
Consider gradual rollback for non-critical issues
Instead of immediate 100% rollback, use gradual deployment:
Document the root cause
Document the root cause
After rolling back, investigate and document:
- What caused the issue
- How to prevent it in the future
- Whether resource data needs cleanup
Be aware of secret changes
Be aware of secret changes
If you’ve updated secrets since the target version:
- Understand which secrets changed
- Verify the old code works with current secret values
- Update secrets if necessary after rollback
Troubleshooting
”Could not find stable Worker Version to rollback to”
Cause: No previous deployment had a single version at 100% traffic. Solution: Specify an explicit version ID:“Cannot rollback with modified secrets”
Cause: Secrets have changed since the target version was deployed. Solution:- Review which secrets changed (shown in error message)
- Confirm you understand the implications
- Proceed when Wrangler prompts for confirmation
“Worker name missing”
Cause: Worker name not in config or specified as argument. Solution: Add to config or specify explicitly:wrangler.json:
Configuration
You can set the Worker name in your configuration file:wrangler.json
wrangler rollback without specifying --name each time.