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

# Common Issues

> Resolve common authentication, configuration, email, and database issues

## Authentication & Access

### Reset admin password

For Docker Compose deployments:

```bash theme={null}
docker exec -it docker-api-1 flask reset-password
```

Enter the account email and new password when prompted.

For source code deployments, run the same command from the `api` directory.

### 401 errors after login

If the error started after a domain change, check that the [public URLs](https://docs.dify.ai/en/self-host/deploy/configuration/environments.md#common-variables) match the new domain. Also review `CONSOLE_CORS_ALLOW_ORIGINS` and `WEB_API_CORS_ALLOW_ORIGINS` under [CORS Configuration](https://docs.dify.ai/en/self-host/deploy/configuration/environments.md#cors-configuration).

From `dify/docker`, validate and apply the changes with the deployment's existing Compose project and options:

```bash theme={null}
docker compose config --quiet
docker compose up -d
```

## Configuration

### Change default port

Modify `.env` configuration:

```dotenv theme={null}
EXPOSE_NGINX_PORT=80
EXPOSE_NGINX_SSL_PORT=443
```

For API service port changes, update the nginx configuration in `docker-compose.yaml`.

### Increase file upload limits

Update in `.env`:

* `UPLOAD_FILE_SIZE_LIMIT` - Maximum file size
* `NGINX_CLIENT_MAX_BODY_SIZE` - Must match to avoid issues

### Workflow complexity limits

Adjust `MAX_TREE_DEPTH` in `web/app/components/workflow/constants.ts` (default: 50).

Note: Excessive depth impacts performance.

### Node execution timeout

Set `TEXT_GENERATION_TIMEOUT_MS` in `.env` to control runtime per node.

## Email Configuration

Not receiving password reset emails? Configure mail settings in `.env`:

1. Set up mail parameters (SMTP settings)
2. Restart services:

```bash theme={null}
docker compose down
docker compose up -d
```

Check spam folder if emails still don't arrive.

### Invite members without email service

In local deployments without email configured, the invitation page displays a link after sending. Copy and forward this link to users manually.

## Database Issues

### Connection errors with pg\_hba.conf

If you see:

```text theme={null}
FATAL: no pg_hba.conf entry for host "172.19.0.7", user "postgres", database "dify", no encryption
```

Allow connections from the error's network segment:

```bash theme={null}
docker exec -it docker-db-1 sh -c "echo 'host all all 172.19.0.0/16 trust' >> /var/lib/postgresql/data/pgdata/pg_hba.conf"
docker-compose restart
```

### File not found error for encryption keys

This error occurs after changing deployment methods or deleting `api/storage/privkeys`:

```text theme={null}
FileNotFoundError: File not found
File "/www/wwwroot/dify/dify/api/libs/rsa.py", line 45, in decrypt
```

Reset encryption key pairs:

Docker Compose:

```bash theme={null}
docker exec -it docker-api-1 flask reset-encrypt-key-pair
```

Source code (from `api` directory):

```bash theme={null}
flask reset-encrypt-key-pair
```

> [!WARNING]
>
> This is irreversible. Existing LLM credentials and tool credentials (built-in, custom, and MCP tools) are purged for every workspace and must be re-entered.

## Workspace Management

### Rename workspace

Modify the `tenants` table in the database directly.

### Change application access domain

Set `APP_WEB_URL` to the new public base URL. See [Common Variables](https://docs.dify.ai/en/self-host/deploy/configuration/environments.md#common-variables) for where to set it and how to apply the change.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.