Skip to content
Latchkey

GitHub Actions step id containing a dash cannot be referenced in steps context

A step id is used as a property key in the steps context, e.g. steps.build.outputs.x. Ids with dashes still work via bracket access, but dot access (steps.my-step.outputs) parses my and -step separately and resolves to nothing.

What this error means

steps.<id>.outputs.<name> is empty when the step id contains a dash and is accessed with dot syntax.

github-actions
- id: my-step
  run: echo "v=1" >> "$GITHUB_OUTPUT"
- run: echo "${{ steps.my-step.outputs.v }}"   # dot access mis-parses the dash

Common causes

Dash breaks dot property access

Dot access treats the dash as an operator, so steps.my-step does not resolve to the step.

Id mismatch between definition and reference

A reference that does not exactly match the id resolves to an empty object.

How to fix it

Use an id without dashes

  1. Prefer underscores in step ids so dot access works cleanly.
  2. Update all references to the new id.
.github/workflows/ci.yml
- id: my_step
  run: echo "v=1" >> "$GITHUB_OUTPUT"
- run: echo "${{ steps.my_step.outputs.v }}"

Reference a dashed id with bracket syntax

  1. If you must keep the dash, use bracket access on the steps context.
  2. Quote the id inside the brackets.
.github/workflows/ci.yml
- run: echo "${{ steps['my-step'].outputs.v }}"

How to prevent it

  • Use underscores, not dashes, in step ids.
  • Keep id definitions and references identical.

Frequently asked questions

What causes "step id with dash"?
Dot access treats the dash as an operator, so steps.my-step does not resolve to the step.
How do I fix step id with dash?
Use an id without dashes

Related guides

References

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