# Deployment Error Troubleshooting

Common deployment errors and solutions.

## Configuration Validation Errors

### Error: Invalid Nickel Syntax

```text
Error: Syntax error at line 15: unexpected token '}'
```

**Solution**: Check closing braces match opening braces

```bash
provisioning infra validate --verbose
```

### Error: Schema Validation Failed

```text
Error: Field 'cpu' type mismatch. Expected Number, got String
```

**Solution**: Ensure all fields match schema types

```nickel
# Wrong
servers = { cpu = "4" }

# Correct
servers = { cpu = 4 }
```

## Credential Errors

### Error: Authentication Failed

```text
Error: AWS authentication failed: InvalidClientTokenId
```

**Solution**: Verify credentials

```bash
aws sts get-caller-identity
export AWS_ACCESS_KEY_ID="..."
export AWS_SECRET_ACCESS_KEY="..."
```

### Error: Permission Denied

```text
Error: Access Denied (Code: 403)
```

**Solution**: Check IAM permissions

```bash
aws iam get-user
aws iam list-user-policies --user-name $(aws iam get-user --query User.UserName --output text)
```

## Network Errors

### Error: Connection Timeout

```text
Error: Timeout connecting to API endpoint
```

**Solution**: Check network connectivity

```bash
ping api.provider.com
curl -v  [https://api.provider.com/health](https://api.provider.com/health)
```

### Error: DNS Resolution Failed

```text
Error: Failed to resolve host: api.example.com
```

**Solution**: Check DNS configuration

```bash
nslookup api.example.com
dig api.example.com
```

## Resource Errors

### Error: Insufficient Quota

```text
Error: You have reached the maximum number of instances (20)
```

**Solution**: Increase quota or delete unused resources

```bash
provisioning resource list --unused
provisioning resource delete <id>
```

### Error: Instance Type Not Available

```text
Error: t3.large not available in us-east-1a
```

**Solution**: Try different instance type or zone

```nickel
instance_type = "t3.xlarge"  # Try larger
# Or
availability_zone = "us-east-1b"  # Try different AZ
```

## Related Documentation

- [Common Issues](./common-issues.md)
- [Debug Guide](./debug-guide.md)
- [Logs Analysis](./logs-analysis.md)
