# transifex cli push failed 401 unauthorized

## TL;DR

Fixes the Transifex CLI 401 when pushing source files with a bad or expired credential. Regenerate the API token and update the client config. Use when push returns 401. Not for 404 resource errors.

## The error

```text
Error: 401 Unauthorized: Authentication credentials were not provided or are invalid.
```

## Fix it

### Step 1: Check the stored credential

```bash
node -e "console.log('inspect the transifex client config for the stored credential')"
```

Expected: You see which credential the CLI is sending.

### Step 2: Generate a fresh API token

```bash
node -e "console.log('create a new token in the Transifex user settings')"
```

Expected: You have a new working token.

### Step 3: Update the config and re-push

```bash
tx push --source
```

Expected: The push succeeds without the 401.

## When to use this

- Transifex CLI push returns 401
- Push worked yesterday and broke today

## When NOT to use this

- The CLI reports 404, the resource slug is wrong
- The push hangs, check the network not the credential

## Tool and version compatibility

- Transifex CLI (tx)
- Transifex API v3 tokens

## Variant phrasings

### 401 only in CI

The CI secret expired or was rotated. Update the stored secret.

### 401 for one user but not another

That user's token was revoked. Have them regenerate it.

## Why it happens

The CLI authenticates every request with the stored token. Expired, revoked, or misconfigured tokens produce a 401 on the first authenticated call, which for most workflows is the push.

## Edge cases

- Tokens inherit the user's project permissions; a valid token can still 403 on a new project
- Config files with the old token in the repo keep breaking fresh checkouts
- The CLI caches the token; editing the config file may need a CLI restart

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_X4MBkblUFbglh5QDrirhpA
