# Troubleshooting

## Not Authenticated

Error:

```text
Not authenticated. Run `toggl auth` to sign in.
```

Fix:

```bash
toggl auth
```

Use `toggl profile list` and `toggl profile switch [<profile>]` (omit name in a TTY for an interactive picker) if the user intended a different auth context.

## Workspace Problems

If data appears missing or a command targets the wrong workspace:

```bash
toggl --json profile current
toggl --json profile list
toggl --json workspace list
toggl --json workspace list --refresh
toggl --json workspace switch <workspace-id>
```

For one-off calls, prefer:

```bash
toggl --workspace-id <workspace-id> --json tasks list --project-id <project-id>
```

## Invalid JSON

Error:

```text
Invalid JSON from --data
```

Fix shell quoting by using stdin or a file:

```bash
printf '%s\n' '{"task_id":12345,"payload":{"name":"Renamed task"}}' | toggl --json tasks update --data -
toggl --json tasks update --data-file ./payload.json
```

## Missing Fields

Error:

```text
Invalid input: task_id: required
```

Add the named scalar flag or include the field in `--data`:

```bash
toggl --json tasks get --task-id 12345
toggl --json tasks get --data '{"task_id":12345}'
```

## Date Validation

Use `YYYY-MM-DD` for full days or RFC 3339 for exact datetimes:

```bash
toggl --json time-entries list --date-from 2026-04-01 --date-to 2026-04-07
toggl --json time-blocks list --date-from 2026-04-01T08:00:00+03:00 --date-to 2026-04-01T17:00:00+03:00
```

## Destructive Operation Blocked

Delete commands fail without `--yes`. Only retry with `--yes` when the user explicitly requested the delete and the ID is confirmed:

```bash
toggl --json tasks delete --task-id <task-id> --yes
```

## Schema Warnings

For API response schema warnings, rerun with debug enabled:

```bash
TOGGL_DEBUG=1 toggl --json tasks list --project-id 123456
```

## Unknown Command Shape

Inspect help before guessing:

```bash
toggl --help
toggl tasks --help
toggl tasks update --help
```
