Skip to content
Latchkey

Firebase "Invalid argument ... rules" in CI

The rules deploy request was accepted for auth but rejected as an invalid argument. The rules reference a resource that does not exist, or the request targets a service that is not enabled on the project.

What this error means

A rules deploy fails with "Error: HTTP Error: 400, Invalid argument" referencing the ruleset or a missing database or storage bucket.

firebase
Error: HTTP Error: 400, Invalid argument. Request contains an invalid argument.

Common causes

The target resource does not exist

Deploying Firestore or Storage rules to a project without a database or default bucket provisioned yields a 400.

The ruleset references an unavailable service

Rules for a product that is not enabled on the project are rejected as an invalid argument.

How to fix it

Provision the resource first

  1. Create the Firestore database or Storage bucket the rules target.
  2. Confirm the product is enabled in the console.
  3. Re-run the rules deploy.
Terminal
firebase deploy --only firestore:rules,storage --project my-project

Deploy with --debug to see the argument

The debug output identifies which argument the API rejected, so you can correct the config.

Terminal
firebase deploy --only firestore:rules --project my-project --debug

How to prevent it

  • Provision databases and buckets before deploying their rules.
  • Enable each product on the project before deploying its rules.
  • Use --debug to pinpoint an invalid argument quickly.

Frequently asked questions

What causes ""HTTP Error: 400 ... rules""?
Deploying Firestore or Storage rules to a project without a database or default bucket provisioned yields a 400.
How do I fix "HTTP Error: 400 ... rules"?
Provision the resource first

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card