🐛 Container crashes on startup with Missing apple_id field when no session exists
📝 Description
When running mandarons/icloud-docker, the container consistently crashes during startup authentication with the following error:
P.s. Thank you for all your work on this. When it worked/works... I loved it!
icloudpy.exceptions.ICloudPyFailedLoginException:
('Invalid authentication token.', ICloudPyAPIResponseException('Missing apple_id field'))
This happens even in a completely clean environment where no session file exists.
The logs show:
Session file does not exist
Missing apple_id field
Invalid authentication token
🔁 Steps to reproduce
- Use a fresh Docker setup with persistent volumes:
volumes:
- /config:/config
- /icloud:/icloud
- Configure credentials:
app:
credentials:
username: "your_apple_id@email.com"
- Ensure no prior session exists:
rm -rf /config/session_data
rm -rf /home/abc/.local/*
- Start the container:
❌ Actual behavior
The container crashes immediately and loops:
Session file does not exist
Missing apple_id field
Invalid authentication token
The process restarts continuously.
✅ Expected behavior
When no session exists, the container should:
- Fall back to username/password authentication
- Trigger fresh Apple login flow (2FA prompt)
- Create a new session file after successful login
🔍 Observations / possible root cause
It appears the application always attempts token authentication first:
_authenticate_with_token()
even when:
- No session file exists
- No valid token is available
This leads to a failure inside icloudpy:
ICloudPyAPIResponseException('Missing apple_id field')
It looks like an unhandled or invalid token state is being passed into the authentication flow, causing a crash before fallback authentication can occur.
🧪 Environment
- Image:
mandarons/icloud-drive:latest
- Docker version:
Docker version 29.6.0, build fb59821
- OS: Linux Debian
- UID/GID: 1000:1000

🐛 Container crashes on startup with
Missing apple_id fieldwhen no session exists📝 Description
When running
mandarons/icloud-docker, the container consistently crashes during startup authentication with the following error:P.s. Thank you for all your work on this. When it worked/works... I loved it!
This happens even in a completely clean environment where no session file exists.
The logs show:
🔁 Steps to reproduce
rm -rf /config/session_data rm -rf /home/abc/.local/*❌ Actual behavior
The container crashes immediately and loops:
The process restarts continuously.
✅ Expected behavior
When no session exists, the container should:
🔍 Observations / possible root cause
It appears the application always attempts token authentication first:
even when:
This leads to a failure inside
icloudpy:It looks like an unhandled or invalid token state is being passed into the authentication flow, causing a crash before fallback authentication can occur.
🧪 Environment
mandarons/icloud-drive:latestDocker version 29.6.0, build fb59821