{"record":{"id":"a1e70c472005d1ea","repo":"glanceapp/glance","slug":"user-has-no-name","errorCode":null,"errorMessage":"user has no name","messagePattern":"user has no name","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/glance/config.go","lineNumber":462,"sourceCode":"\t}, nil\n}\n\n// TODO: Refactor, we currently validate in two different places, this being\n// one of them, which doesn't modify the data and only checks for logical errors\n// and then again when creating the application which does modify the data and do\n// further validation. Would be better if validation was done in a single place.\nfunc isConfigStateValid(config *config) error {\n\tif len(config.Pages) == 0 {\n\t\treturn fmt.Errorf(\"no pages configured\")\n\t}\n\n\tif len(config.Auth.Users) > 0 && config.Auth.SecretKey == \"\" {\n\t\treturn fmt.Errorf(\"secret-key must be set when users are configured\")\n\t}\n\n\tfor username := range config.Auth.Users {\n\t\tif username == \"\" {\n\t\t\treturn fmt.Errorf(\"user has no name\")\n\t\t}\n\n\t\tif len(username) < 3 {\n\t\t\treturn errors.New(\"usernames must be at least 3 characters\")\n\t\t}\n\n\t\tuser := config.Auth.Users[username]\n\n\t\tif user.Password == \"\" {\n\t\t\tif user.PasswordHashString == \"\" {\n\t\t\t\treturn fmt.Errorf(\"user %s must have a password or a password-hash set\", username)\n\t\t\t}\n\t\t} else if len(user.Password) < 6 {\n\t\t\treturn fmt.Errorf(\"the password for %s must be at least 6 characters\", username)\n\t\t}\n\t}\n\n\tif config.Server.AssetsPath != \"\" {","sourceCodeStart":444,"sourceCodeEnd":480,"githubUrl":"https://github.com/glanceapp/glance/blob/91324e8de762702e97b0ac5c8e36271d644d8642/internal/glance/config.go#L444-L480","documentation":"A user entry under auth.users has an empty username. Because users is parsed as a map keyed by username, this means a user record exists whose key is the empty string — typically a malformed users list item.","triggerScenarios":"Writing auth.users as a list of objects without username fields, or with a blank key in map form (\"\": {password: ...}), produces a map entry keyed by \"\" and trips this check.","commonSituations":"Copy-pasting a user block and deleting the username line; mixing up list and map syntax for users; a typo like user instead of username that silently yields an empty map key.","solutions":["Ensure each entry under auth.users has a non-empty username field","Check the exact field name is username (not user or name)","Verify the YAML structure matches the documented form"],"exampleFix":"# before\nauth:\n  users:\n    - password: secret\n# after\nauth:\n  users:\n    - username: alice\n      password: secret","handlingStrategy":"validation","validationCode":"// Lint users before applying\nfor name := range cfg.Auth.Users {\n    if name == \"\" {\n        return errors.New(\"auth.users contains an entry without username\")\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Template every user entry as: - username: X + password/hash","Lint config in CI with yamllint plus a glance config check"],"tags":["glance","auth","configuration","yaml"],"backgroundTag":null,"analyzedSha":"91324e8de762702e97b0ac5c8e36271d644d8642","analyzedAt":"2026-08-15T14:12:54.279Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}