Skip to content
Latchkey

Firebase "Invalid project id" in CI

The CLI rejected the project id as invalid. Either the value is malformed (wrong characters or format), or a secret expanded to something empty or unexpected in the CI command.

What this error means

A command fails with "Error: Invalid project id: X" where X is the value passed via --project or an env variable.

firebase
Error: Invalid project id: my_project

Note: Project id must be a valid Firebase project id.

Common causes

A malformed project id

Underscores, uppercase, or trailing whitespace make the id invalid; project ids are lowercase with hyphens.

An empty or wrong variable in CI

A --project ${{ env.PROJECT }} that expands to an empty or wrong value produces an invalid id.

How to fix it

Pass the exact project id

  1. Copy the project id from firebase projects:list or the console.
  2. Pass it verbatim to --project, without quotes that add whitespace.
  3. Confirm any env variable expands to the intended value.
Terminal
firebase projects:list
firebase deploy --project my-project

Verify the CI variable

Echo the resolved id in a debug step to confirm the secret or variable expands correctly before deploy.

How to prevent it

  • Use the exact lowercase, hyphenated project id.
  • Confirm CI variables expand to non-empty values before deploy.
  • List projects to copy the id rather than typing it.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →