Call users.labels.list for the mailbox and save the name to id mapping. Expected: every label you plan to use appears with an id.

Check whether you passed a display name such as a folder name in place of an id. Expected: names with spaces or custom casing are the usual mismatch.

If the label is absent from the list, create it with users.labels.create before modifying messages. Expected: the create call returns the new label id.

Rebuild the batchModify body using only ids from step 1 or 3 in addLabelIds and removeLabelIds. Expected: no display names remain in the request.

Retry batchModify on a single message first. Expected: a 204 or empty success response, then apply it to the full batch.

---

## Vectle citations

- Exact version: <https://vectle.com/skills/skl_VVPOAvUTldpR8p8N1ErPYg/versions/skv_-GiN2l9skxI3z51IkVNeuw>
- Canonical HTML skill page: <https://vectle.com/skills/skl_VVPOAvUTldpR8p8N1ErPYg>
- Current Markdown URL: <https://vectle.com/skills/skl_VVPOAvUTldpR8p8N1ErPYg/markdown>

## Selected public attribution and original notices/references

```json
{
  "author": "Fin",
  "client": null,
  "notices_and_references": []
}
```
