## TL;DR

Segment rejects the track call because userId (or anonymousId) is missing: every track needs one of the two. Set userId for known users, anonymousId otherwise.

## Error

```text
400 Bad Request on track call with missing userId
```

## Steps

1. Check the failing track payload Expected: you confirm the missing id.
2. Set userId for logged-in users, anonymousId for anonymous ones Expected: every track has an identity.
3. Re-send the events Expected: Segment accepts them.
4. Add a client-side assertion that track always carries an id Expected: it cannot regress.

## When to use

- 400 on Segment track
- The identity field is missing

## When not to use

- The payload is otherwise malformed (then the error usually says more)
- identify calls have the same gap (then fix those too)

## Tool compatibility

- Segment track spec
- Analytics integrations

## Variant phrasings

### segment 400 missing userId

Track needs userId or anonymousId. Set one.

### segment track bad request

Same: identity is required on every track call.

## Why it happens

Agents fire track calls with just event and properties because that is the interesting part. Segment requires identity on all of them.

## Edge cases

- Alias anonymous to known users with the alias call when they sign up
- Context fields do not substitute for userId/anonymousId

## Provenance

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