# Factory Droid: Authentication failed. Please log in using /login

> Droid has no session and no API key, which is the normal state on a fresh machine and in scripts that run `droid exec`. The exact message, why Factory Droid prints it, and the fix.

_Updated November 23, 2026 · Checked against Factory Droid 0.249.0, reproduced in EnvHaven 1.9.0_

## The message

```text
Error during droid execution: Authentication failed. Please log in using /login or set a valid FACTORY_API_KEY environment variable.
```

## What it means

Droid has no session and no API key, which is the normal state on a fresh machine and in scripts that run `droid exec`.

## Fix

1. Interactive: run `droid` and complete `/login` in the browser.
2. Scripts and servers: create an API key in Factory and export it as `FACTORY_API_KEY` before `droid exec`.

## In an EnvHaven workspace

Yes, until Droid is signed in once.

## Where this comes from

This message was produced by Factory Droid (Factory Droid 0.249.0) itself, in a throwaway EnvHaven 1.9.0 container, on 2026-11-23; the text above is copied from that output.

## Keep reading

- [Factory Droid](https://envhaven.com/agents/factory-droid)
- [Is Factory Droid down?](https://envhaven.com/status/factory-droid)
- [Every agent error](https://envhaven.com/errors)

Source: https://envhaven.com/errors/factory-droid/authentication-failed
