> ## Documentation Index
> Fetch the complete documentation index at: https://docs.wandb.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# How do I fix service account errors like `Unauthorized` or missing runs?

When you use a service account to automate W\&B workflows, you might encounter authorization errors or find that runs don't appear where you expect them. This article describes common service account issues and how to resolve them so your automated runs log to the correct entity with the right permissions.

## "Unauthorized" errors

Verify the API key is correctly set and the service account has access to the target project. For restricted projects, you must explicitly add the service account to the project's access list.

## Runs not appearing

Check that the `WANDB_ENTITY` environment variable is set to the correct team name. Replace `[TEAM_NAME]` with your team's name:

```bash theme={null}
export WANDB_ENTITY=[TEAM_NAME]
```

If `WANDB_ENTITY` isn't set, runs may log to the wrong entity.

## User attribution not working

If you use `WANDB_USERNAME` to attribute automated runs to a human user, ensure the user specified is a member of the team. Replace `[USERNAME]` with the W\&B username:

```bash theme={null}
export WANDB_USERNAME=[USERNAME]
```

## Access denied to restricted projects

Explicitly add the service account to the restricted project's access list. Service accounts don't automatically have access to restricted projects, even if they belong to the team.

For more information, see [Use service accounts to automate workflows](/platform/hosting/iam/service-accounts).

***

<Badge stroke shape="pill" color="orange" size="md">[Administrator](/support/models/tags/administrator)</Badge><Badge stroke shape="pill" color="orange" size="md">[Security](/support/models/tags/security)</Badge>
