plandex-ai/plandex · error
error resolving org: %v
Error message
error resolving org: %v
What it means
After ListOrgs succeeds, SelectOrSignInOrCreate calls resolveOrgAuth(orgs, selectedAuth.IsLocalMode) to pick which organization to authenticate against. This error wraps any failure from that resolution — typically no orgs are available to the account or the desired org could not be matched. It is thrown before any org is written to the local auth store.
Source
Thrown at app/cli/auth/account.go:82
selectedAuth := *selected
setAuth(&shared.ClientAuth{
ClientAccount: selectedAuth,
})
term.StartSpinner("")
orgs, apiErr := apiClient.ListOrgs()
term.StopSpinner()
if apiErr != nil {
return fmt.Errorf("error listing orgs: %v", apiErr.Msg)
}
org, err := resolveOrgAuth(orgs, selectedAuth.IsLocalMode)
if err != nil {
return fmt.Errorf("error resolving org: %v", err)
}
err = setAuth(&shared.ClientAuth{
ClientAccount: *selected,
OrgId: org.Id,
OrgName: org.Name,
OrgIsTrial: org.IsTrial,
IntegratedModelsMode: org.IntegratedModelsMode,
})
if err != nil {
return fmt.Errorf("error setting auth: %v", err)
}
_, apiErr = apiClient.GetOrgSession()
if apiErr != nil {
return fmt.Errorf("error getting org session: %v", apiErr.Msg)View on GitHub (pinned to e2d772072e)
Solutions
- Check which orgs the account actually belongs to (server admin UI or invite emails) and accept any pending org invite.
- If the previously used org was deleted, clear local auth and sign in again to pick a valid org.
- For local-mode mismatches, ensure the server has the local org set up or switch off local mode.
- If developing, log orgs before resolveOrgAuth to confirm the expected org Id/Name is present in the list.
Defensive patterns
Strategy: validation
Validate before calling
orgs, err := listOrgsForAccount(account)
if err != nil { return err }
if len(orgs) == 0 {
return fmt.Errorf("account %s belongs to no orgs; accept an invite or create an org before signing in", account.Email)
} Type guard
func hasUsableOrg(orgs []shared.Org, isLocalMode bool) (*shared.Org, bool) {
for i := range orgs {
if !isLocalMode || orgs[i].IsLocal {
return &orgs[i], true
}
}
return nil, false
} Try / catch
if err := auth.SelectOrSignInOrCreate(); err != nil {
if strings.Contains(err.Error(), "error resolving org") {
// org no longer available: wipe org selection and re-auth to pick another
clearStoredOrg()
return auth.SelectOrSignInOrCreate()
}
return err
} Prevention
- Ensure the account is a member of at least one org (accept invites) before automating sign-in.
- Don't cache a single org ID in scripts; re-resolve from the orgs list each session.
- Keep local-mode accounts on servers that actually provision the local org.
When it happens
Trigger: resolveOrgAuth returns an error: the orgs list returned by the server is empty, the account's previously stored org no longer exists in the list, or in local-mode the local org is absent from the returned orgs.
Common situations: A developer account removed from all orgs; an org deleted or renamed server-side while local auth still references it; local-mode account used against a server that has no corresponding local org; trial org expired.
Related errors
- error listing orgs: %v
- error getting org session: %v
- error converting orgs to api orgs: %v
- error loading accounts: %v
- error signing in to new account: %v
AI-assisted analysis of plandex-ai/plandex@e2d772072e (2026-09-05).
Data as JSON: /api/errors/0d8fc582bd8605da.
Report an issue: GitHub.