Skip to content
Latchkey

GitHub Actions "The identifier is invalid" for a job id

Job ids must start with a letter or underscore and contain only alphanumerics, hyphens, and underscores. An invalid id fails validation.

What this error means

The workflow is rejected with "The identifier '<id>' is invalid" naming the offending job key.

github-actions
The workflow is not valid. .github/workflows/ci.yml (Line: 6): The identifier '2-build' is invalid. IDs may only contain alphanumeric characters, '_', and '-'. IDs must start with a letter or '_'.

Common causes

Job id starts with a digit

A leading number such as 2-build is not a valid identifier.

Disallowed characters

Spaces, dots, or slashes in the job key are not permitted.

How to fix it

Rename the job to a valid id

  1. Start the id with a letter or underscore.
  2. Use only letters, digits, hyphens, and underscores.
  3. Update any needs: references to the new id.
.github/workflows/ci.yml
jobs:
  build-2:
    runs-on: ubuntu-latest
    steps:
      - run: make

How to prevent it

  • Adopt a naming convention that always begins job ids with a letter.
  • Run actionlint, which validates identifier rules.

Frequently asked questions

What causes ""The identifier 'X' is invalid""?
A leading number such as 2-build is not a valid identifier.
How do I fix "The identifier 'X' is invalid"?
Rename the job to a valid id

Related guides

References

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