{"record":{"id":"ac34e27af47dd9a4","repo":"m1k1o/neko","slug":"cannot-select-user-in-multiuser-mode","errorCode":null,"errorMessage":"cannot select user in multiuser mode","messagePattern":"cannot select user in multiuser mode","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/internal/member/multiuser/provider.go","lineNumber":73,"sourceCode":"\t}\n\n\treturn \"\", types.MemberProfile{}, types.ErrMemberInvalidPassword\n}\n\nfunc (provider *MemberProviderCtx) Insert(username string, password string, profile types.MemberProfile) (string, error) {\n\treturn \"\", errors.New(\"new user is created on first login in multiuser mode\")\n}\n\nfunc (provider *MemberProviderCtx) UpdateProfile(id string, profile types.MemberProfile) error {\n\treturn nil\n}\n\nfunc (provider *MemberProviderCtx) UpdatePassword(id string, password string) error {\n\treturn errors.New(\"password can only be modified in config while in multiuser mode\")\n}\n\nfunc (provider *MemberProviderCtx) Select(id string) (types.MemberProfile, error) {\n\treturn types.MemberProfile{}, errors.New(\"cannot select user in multiuser mode\")\n}\n\nfunc (provider *MemberProviderCtx) SelectAll(limit int, offset int) (map[string]types.MemberProfile, error) {\n\treturn map[string]types.MemberProfile{}, nil\n}\n\nfunc (provider *MemberProviderCtx) Delete(id string) error {\n\treturn errors.New(\"cannot delete user in multiuser mode\")\n}\n","sourceCodeStart":55,"sourceCodeEnd":83,"githubUrl":"https://github.com/m1k1o/neko/blob/b0f01cedea68893e85a3fd852c0521238c285695/server/internal/member/multiuser/provider.go#L55-L83","documentation":"The multiuser provider does not keep an in-memory member registry keyed by ID; members exist only as config entries and sessions created on first login. Select() is therefore unsupported and always returns this error instead of a profile.","triggerScenarios":"Any call to the member Select API (lookup a member profile by ID, e.g. admin user-detail endpoint) while the member provider is 'multiuser'.","commonSituations":"An admin panel tries to fetch a user profile by ID after authentication; in multiuser mode this lookup is not implemented, so it always fails even for users who logged in successfully.","solutions":["Do not call Select in multiuser mode; use the session/authenticated state instead of member lookup.","Read the intended user data from the server config entries directly.","Switch to a dynamic member provider if per-ID profile lookup is required."],"exampleFix":"// before\nprofile, err := memberClient.Select(id)\n\n// after: guard against unsupported mode\nif memberProvider == \"multiuser\" {\n    return errors.New(\"user lookup unsupported in multiuser mode\")\n}\nprofile, err := memberClient.Select(id)","handlingStrategy":"validation","validationCode":"if memberProvider == \"multiuser\" {\n    return errors.New(\"per-ID member lookup unsupported in multiuser mode\")\n}\nprofile, err := memberClient.Select(id)","typeGuard":"func isSelectUnsupportedErr(err error) bool {\n    return err != nil && strings.Contains(err.Error(), \"cannot select user\")\n}","tryCatchPattern":"profile, err := memberClient.Select(id)\nif err != nil {\n    if isSelectUnsupportedErr(err) {\n        profile = types.MemberProfile{} // fall back to empty/anonymous profile\n    } else {\n        return err\n    }\n}","preventionTips":["Avoid per-ID member lookups in static provider modes; use the session identity instead.","Derive profile data from config entries rather than the members API in multiuser mode.","Gate user-detail admin views on the active member provider.","Remember SelectAll returns an empty map in multiuser mode — do not infer users from it."],"tags":["multiuser","members","unsupported-operation","lookup"],"backgroundTag":"unsupported-operation-mode","analyzedSha":"b0f01cedea68893e85a3fd852c0521238c285695","analyzedAt":"2026-09-01T10:35:56.638Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}