Problem
After a fresh deployment, superAdmin can authenticate successfully via POST /v1/user/login and POST /v1/manager/login, but the web client redirects to an invite-code entry page because no Space exists for the admin user.
When the admin tries to enter any invite code, the error "你已经是该空间成员" (already a space member) is returned — creating a catch-22: the UI demands an invite code to proceed, but the invite/join flow rejects the user as already a member.
Reproduction (fresh Docker Compose deployment)
# 1. Fresh deploy
git clone https://github.com/Mininglamp-OSS/octo-deployment.git
cd octo-deployment
./setup.sh --non-interactive --ip 127.0.0.1
cd docker && docker compose --env-file .env up -d
# 2. Verify superAdmin token works
curl -s -X POST http://127.0.0.1:28081/v1/user/login \
-H 'Content-Type: application/json' \
-d '{"username":"superAdmin","password":"<OCTO_ADMIN_PWD>"}' | jq .
# → returns valid token ✅
# 3. Check spaces for superAdmin
curl -s http://127.0.0.1:28081/v1/space/my -H "token: <token>"
# → [] (empty array — no spaces) ✅ explains web redirect
# 4. Open web UI: http://127.0.0.1:28080
# → Login with superAdmin / <OCTO_ADMIN_PWD>
# → Redirected to invite-code entry page ❌
# → Enter any invite code → "你已经是该空间成员" ❌
Root Cause (source analysis)
1. superAdmin is seeded without a Space
createManagerAccount() in modules/user/api_manager.go only creates the user row — it does not create a default Space or add the admin as a member of any Space:
func (m *Manager) createManagerAccount() {
// Only inserts a User row (UID, name, role=superAdmin, ...)
// No space creation, no space membership
err = m.userDB.Insert(&Model{ ... })
}
2. Web client: empty Space list → invite-code redirect
GET /v1/space/my returns [] for superAdmin → web treats this as "not in any space" → redirects to invite-code entry.
3. joinSpace catches ErrAlreadyMember but space doesn't exist
The joinSpace handler in modules/space/api.go (line ~873) returns "你已经是该空间成员" via ErrAlreadyMember. This appears to be triggered even when GET /v1/space/list returns "空间不存在" — suggesting a data inconsistency between the space membership table and the spaces table after the initial seed.
Expected Behavior
After fresh deployment:
- Option A:
createManagerAccount() automatically creates a default Space and adds superAdmin as owner → web client lands directly on the main UI
- Option B: Web client detects
role == superAdmin with no spaces and shows a "Create your first Space" onboarding flow instead of an invite-code entry page
- Either way: the invite-code catch-22 ("enter code" + "already member" error) must not occur
Environment
- octo-server:
latest (mininglamposs/octo-server Docker image)
- octo-deployment:
main
- Fresh Docker Compose deployment on macOS
Additional Notes
superAdmin can log in to the Admin console (http://127.0.0.1:28080/admin/) without any issue
- The problem is specific to the Web client first-login flow
GET /v1/manager/login works correctly for admin console use cases
- The catch-22 completely blocks
superAdmin from accessing the web client on a fresh install
Problem
After a fresh deployment,
superAdmincan authenticate successfully viaPOST /v1/user/loginandPOST /v1/manager/login, but the web client redirects to an invite-code entry page because no Space exists for the admin user.When the admin tries to enter any invite code, the error "你已经是该空间成员" (already a space member) is returned — creating a catch-22: the UI demands an invite code to proceed, but the invite/join flow rejects the user as already a member.
Reproduction (fresh Docker Compose deployment)
Root Cause (source analysis)
1.
superAdminis seeded without a SpacecreateManagerAccount()inmodules/user/api_manager.goonly creates the user row — it does not create a default Space or add the admin as a member of any Space:2. Web client: empty Space list → invite-code redirect
GET /v1/space/myreturns[]forsuperAdmin→ web treats this as "not in any space" → redirects to invite-code entry.3. joinSpace catches
ErrAlreadyMemberbut space doesn't existThe
joinSpacehandler inmodules/space/api.go(line ~873) returns "你已经是该空间成员" viaErrAlreadyMember. This appears to be triggered even whenGET /v1/space/listreturns "空间不存在" — suggesting a data inconsistency between the space membership table and the spaces table after the initial seed.Expected Behavior
After fresh deployment:
createManagerAccount()automatically creates a default Space and addssuperAdminas owner → web client lands directly on the main UIrole == superAdminwith no spaces and shows a "Create your first Space" onboarding flow instead of an invite-code entry pageEnvironment
latest(mininglamposs/octo-server Docker image)mainAdditional Notes
superAdmincan log in to the Admin console (http://127.0.0.1:28080/admin/) without any issueGET /v1/manager/loginworks correctly for admin console use casessuperAdminfrom accessing the web client on a fresh install