# GitHub Actions: Error: Unable to process command '::set-env name=X::y' successfully. The `set-env` command is disabled

**Code:** `The set-env command is disabled` · **Category:** CI/CD · **Seen on:** GitHub Actions

A script or old action uses `::set-env` / `::add-path`, which GitHub disabled; write to `$GITHUB_ENV` and `$GITHUB_PATH` instead.

## Meaning

The workflow commands were removed for security. Use `echo "NAME=value" >> "$GITHUB_ENV"` and `echo "/my/bin" >> "$GITHUB_PATH"`. The values are available in later steps, not in the current one. Setting `ACTIONS_ALLOW_UNSECURE_COMMANDS` re-enables them but is not recommended.

## Common causes

- `echo "::set-env name=X::value"` in a step
- `echo "::add-path::/path"` in a step
- Old third-party action built on the deprecated toolkit
- Docs copied from before 2020

## Quick fix

1. Use `echo "X=value" >> "$GITHUB_ENV"`
2. Use `echo "$PWD/bin" >> "$GITHUB_PATH"`
3. Update the action that emits the command

## Detailed fix by platform

### GitHub Actions

1. Remember that env set this way is visible in the NEXT steps: `run: echo "BUILD_ID=$RANDOM" >> "$GITHUB_ENV"` then `run: echo $BUILD_ID`

## Code examples

### Environment files

```yaml
- run: |
    echo "BUILD_ID=$GITHUB_RUN_NUMBER" >> "$GITHUB_ENV"
    echo "$HOME/.local/bin" >> "$GITHUB_PATH"
- run: echo "build $BUILD_ID"
```

## How to diagnose

1. **Command** — set-env or add-path?
2. **Source** — Script or action?
3. **Scope** — Used in a later step?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/cicd/gha-set-env-disabled)
