Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] - Failed to create user, now refusing to start #4480

Open
5 of 6 tasks
tecosaur opened this issue Oct 31, 2024 · 9 comments
Open
5 of 6 tasks

[BUG] - Failed to create user, now refusing to start #4480

tecosaur opened this issue Oct 31, 2024 · 9 comments
Labels
bug: confirmed bug Something isn't working

Comments

@tecosaur
Copy link

First Check

  • This is not a feature request.
  • I added a very descriptive title to this issue (title field is above this).
  • I used the GitHub search to find a similar issue and didn't find it.
  • I searched the Mealie documentation, with the integrated search.
  • I already read the docs and didn't find an answer.
  • This issue can be replicated on the demo site (https://demo.mealie.io/).

What is the issue you are experiencing?

A new user tried to login to Mealie with Oauth, it failed and now Mealie refuses to start at all.

Steps to Reproduce

  • Have a new user
  • Have them login to oauth

Please provide relevant logs

Here are the logs from user creation:

Oct 31 12:21:43 golgi mealie[978592]: DEBUG    2024-10-31T12:21:43 - response_closed.complete
Oct 31 12:21:43 golgi mealie[978592]: DEBUG    2024-10-31T12:21:43 - close.started
Oct 31 12:21:43 golgi mealie[978592]: DEBUG    2024-10-31T12:21:43 - close.complete
Oct 31 12:21:43 golgi mealie[978592]: DEBUG    2024-10-31T12:21:43 - [OIDC] No user found. Creating new OIDC user.
Oct 31 12:21:43 golgi mealie[978592]: ERROR    2024-10-31T12:21:43 - [OIDC] Exception while creating user: 3 validation errors for PrivateUser
Oct 31 12:21:43 golgi mealie[978592]: household
Oct 31 12:21:43 golgi mealie[978592]:   Input should be a valid string [type=string_type, input_value=None, input_type=NoneType]
Oct 31 12:21:43 golgi mealie[978592]:     For further information visit https://errors.pydantic.dev/2.8/v/string_type
Oct 31 12:21:43 golgi mealie[978592]: household_id
Oct 31 12:21:43 golgi mealie[978592]:   UUID input should be a string, bytes or UUID object [type=uuid_type, input_value=None, input_type=NoneType]
Oct 31 12:21:43 golgi mealie[978592]:     For further information visit https://errors.pydantic.dev/2.8/v/uuid_type
Oct 31 12:21:43 golgi mealie[978592]: householdSlug
Oct 31 12:21:43 golgi mealie[978592]:   Field required [type=missing, input_value=<mealie.db.models.users.u...bject at 0x7f3dce235820>, input_type=User]
Oct 31 12:21:43 golgi mealie[978592]:     For further information visit https://errors.pydantic.dev/2.8/v/missing
Oct 31 12:21:43 golgi mealie[978592]: ERROR    2024-10-31T12:21:43 - [OIDC] Exception while creating user: 3 validation errors for PrivateUser
Oct 31 12:21:43 golgi mealie[978592]: household
Oct 31 12:21:43 golgi mealie[978592]:   Input should be a valid string [type=string_type, input_value=None, input_type=NoneType]
Oct 31 12:21:43 golgi mealie[978592]:     For further information visit https://errors.pydantic.dev/2.8/v/string_type
Oct 31 12:21:43 golgi mealie[978592]: household_id
Oct 31 12:21:43 golgi mealie[978592]:   UUID input should be a string, bytes or UUID object [type=uuid_type, input_value=None, input_type=NoneType]
Oct 31 12:21:43 golgi mealie[978592]:     For further information visit https://errors.pydantic.dev/2.8/v/uuid_type
Oct 31 12:21:43 golgi mealie[978592]: householdSlug
Oct 31 12:21:43 golgi mealie[978592]:   Field required [type=missing, input_value=<mealie.db.models.users.u...bject at 0x7f3dce235820>, input_type=User]
Oct 31 12:21:43 golgi mealie[978592]:     For further information visit https://errors.pydantic.dev/2.8/v/missing
Oct 31 12:21:43 golgi mealie[978592]: INFO     2024-10-31T12:21:43 - [172.68.86.132:0] 401 Unauthorized "GET /api/auth/oauth/callback?code=authelia_ac__QFSrh7PD7jyyKYzGaUqn9wfKimuuOYjQoPjrVIkVE0.Xe2hcJ7DvLH0mlx8pp7mtgfciFtwcKmxdO7I6hO9-NU&iss=https%3A%2F%2Fauth.te>
Oct 31 12:21:43 golgi mealie[978592]: INFO     2024-10-31T12:21:43 - [172.68.0.177:0] 200 OK "GET /sw.js HTTP/1.1"
Oct 31 12:22:11 golgi mealie[978592]: INFO     2024-10-31T12:22:11 - [127.0.0.1:53050] 200 OK "HEAD / HTTP/1.1"
Oct 31 12:22:37 golgi mealie[978592]: INFO     2024-10-31T12:22:37 - [172.68.0.189:0] 200 OK "GET /api/users/self HTTP/1.1"
Oct 31 12:22:37 golgi mealie[978592]: INFO     2024-10-31T12:22:37 - [172.68.0.189:0] 200 OK "GET /api/app/about/startup-info HTTP/1.1"
Oct 31 12:22:37 golgi mealie[978592]: INFO     2024-10-31T12:22:37 - [172.68.0.189:0] 500 Internal Server Error "GET /api/app/about HTTP/1.1"
Oct 31 12:22:37 golgi mealie[978592]: ERROR    2024-10-31T12:22:37 - Exception in ASGI application
Oct 31 12:22:37 golgi mealie[978592]: Traceback (most recent call last):
Oct 31 12:22:37 golgi mealie[978592]:   File "/nix/store/b2p12s3pf7p04jdpvdlvjpcc7hpnsxhv-python3.12-uvicorn-0.29.0/lib/python3.12/site-packages/uvicorn/protocols/http/h11_impl.py", line 407, in run_asgi
Oct 31 12:22:37 golgi mealie[978592]:     result = await app(  # type: ignore[func-returns-value]
Oct 31 12:22:37 golgi mealie[978592]:              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Oct 31 12:22:37 golgi mealie[978592]:   File "/nix/store/b2p12s3pf7p04jdpvdlvjpcc7hpnsxhv-python3.12-uvicorn-0.29.0/lib/python3.12/site-packages/uvicorn/middleware/proxy_headers.py", line 69, in __call__
Oct 31 12:22:37 golgi mealie[978592]:     return await self.app(scope, receive, send)
Oct 31 12:22:37 golgi mealie[978592]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Oct 31 12:22:37 golgi mealie[978592]:   File "/nix/store/sw6qaw2c535gpcnhrf7nmg8liqp4s63c-python3.12-fastapi-0.112.0/lib/python3.12/site-packages/fastapi/applications.py", line 1054, in __call__
Oct 31 12:22:37 golgi mealie[978592]:     await super().__call__(scope, receive, send)
Oct 31 12:22:37 golgi mealie[978592]:   File "/nix/store/3pbsd13z4x74zi73fb3xp8nbf3pqdxx3-python3.12-starlette-0.37.2/lib/python3.12/site-packages/starlette/applications.py", line 123, in __call__
Oct 31 12:22:37 golgi mealie[978592]:     await self.middleware_stack(scope, receive, send)
Oct 31 12:22:37 golgi mealie[978592]:   File "/nix/store/3pbsd13z4x74zi73fb3xp8nbf3pqdxx3-python3.12-starlette-0.37.2/lib/python3.12/site-packages/starlette/middleware/errors.py", line 186, in __call__
Oct 31 12:22:37 golgi mealie[978592]:     raise exc
Oct 31 12:22:37 golgi mealie[978592]:   File "/nix/store/3pbsd13z4x74zi73fb3xp8nbf3pqdxx3-python3.12-starlette-0.37.2/lib/python3.12/site-packages/starlette/middleware/errors.py", line 164, in __call__
Oct 31 12:22:37 golgi mealie[978592]:     await self.app(scope, receive, _send)
Oct 31 12:22:37 golgi mealie[978592]:   File "/nix/store/3pbsd13z4x74zi73fb3xp8nbf3pqdxx3-python3.12-starlette-0.37.2/lib/python3.12/site-packages/starlette/middleware/sessions.py", line 85, in __call__
Oct 31 12:22:37 golgi mealie[978592]:     await self.app(scope, receive, send_wrapper)
Oct 31 12:22:37 golgi mealie[978592]:   File "/nix/store/3pbsd13z4x74zi73fb3xp8nbf3pqdxx3-python3.12-starlette-0.37.2/lib/python3.12/site-packages/starlette/middleware/gzip.py", line 24, in __call__
Oct 31 12:22:37 golgi mealie[978592]:     await responder(scope, receive, send)
Oct 31 12:22:37 golgi mealie[978592]:     await self.app(scope, receive, self.send_with_gzip)
Oct 31 12:22:37 golgi mealie[978592]:   File "/nix/store/3pbsd13z4x74zi73fb3xp8nbf3pqdxx3-python3.12-starlette-0.37.2/lib/python3.12/site-packages/starlette/middleware/exceptions.py", line 65, in __call__
Oct 31 12:22:37 golgi mealie[978592]:     await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
Oct 31 12:22:37 golgi mealie[978592]:   File "/nix/store/3pbsd13z4x74zi73fb3xp8nbf3pqdxx3-python3.12-starlette-0.37.2/lib/python3.12/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
Oct 31 12:22:37 golgi mealie[978592]:     raise exc
Oct 31 12:22:37 golgi mealie[978592]:   File "/nix/store/3pbsd13z4x74zi73fb3xp8nbf3pqdxx3-python3.12-starlette-0.37.2/lib/python3.12/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
Oct 31 12:22:37 golgi mealie[978592]:     await app(scope, receive, sender)
Oct 31 12:22:37 golgi mealie[978592]:   File "/nix/store/3pbsd13z4x74zi73fb3xp8nbf3pqdxx3-python3.12-starlette-0.37.2/lib/python3.12/site-packages/starlette/routing.py", line 756, in __call__
Oct 31 12:22:37 golgi mealie[978592]:     await self.middleware_stack(scope, receive, send)
Oct 31 12:22:37 golgi mealie[978592]:   File "/nix/store/3pbsd13z4x74zi73fb3xp8nbf3pqdxx3-python3.12-starlette-0.37.2/lib/python3.12/site-packages/starlette/routing.py", line 776, in app
Oct 31 12:22:37 golgi mealie[978592]:     await route.handle(scope, receive, send)
Oct 31 12:22:37 golgi mealie[978592]:   File "/nix/store/3pbsd13z4x74zi73fb3xp8nbf3pqdxx3-python3.12-starlette-0.37.2/lib/python3.12/site-packages/starlette/routing.py", line 297, in handle
Oct 31 12:22:37 golgi mealie[978592]:     await self.app(scope, receive, send)
Oct 31 12:22:37 golgi mealie[978592]:   File "/nix/store/3pbsd13z4x74zi73fb3xp8nbf3pqdxx3-python3.12-starlette-0.37.2/lib/python3.12/site-packages/starlette/routing.py", line 77, in app
Oct 31 12:22:37 golgi mealie[978592]:     await wrap_app_handling_exceptions(app, request)(scope, receive, send)
Oct 31 12:22:37 golgi mealie[978592]:   File "/nix/store/3pbsd13z4x74zi73fb3xp8nbf3pqdxx3-python3.12-starlette-0.37.2/lib/python3.12/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
Oct 31 12:22:37 golgi mealie[978592]:     raise exc
Oct 31 12:22:37 golgi mealie[978592]:   File "/nix/store/3pbsd13z4x74zi73fb3xp8nbf3pqdxx3-python3.12-starlette-0.37.2/lib/python3.12/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
Oct 31 12:22:37 golgi mealie[978592]:     await app(scope, receive, sender)
Oct 31 12:22:37 golgi mealie[978592]:   File "/nix/store/3pbsd13z4x74zi73fb3xp8nbf3pqdxx3-python3.12-starlette-0.37.2/lib/python3.12/site-packages/starlette/routing.py", line 72, in app
Oct 31 12:22:37 golgi mealie[978592]:     response = await func(request)
Oct 31 12:22:37 golgi mealie[978592]:                ^^^^^^^^^^^^^^^^^^^
Oct 31 12:22:37 golgi mealie[978592]:   File "/nix/store/sw6qaw2c535gpcnhrf7nmg8liqp4s63c-python3.12-fastapi-0.112.0/lib/python3.12/site-packages/fastapi/routing.py", line 278, in app
Oct 31 12:22:37 golgi mealie[978592]:     raw_response = await run_endpoint_function(
Oct 31 12:22:37 golgi mealie[978592]:                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Oct 31 12:22:37 golgi mealie[978592]:   File "/nix/store/sw6qaw2c535gpcnhrf7nmg8liqp4s63c-python3.12-fastapi-0.112.0/lib/python3.12/site-packages/fastapi/routing.py", line 193, in run_endpoint_function
Oct 31 12:22:37 golgi mealie[978592]:     return await run_in_threadpool(dependant.call, **values)
Oct 31 12:22:37 golgi mealie[978592]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Oct 31 12:22:37 golgi mealie[978592]:   File "/nix/store/3pbsd13z4x74zi73fb3xp8nbf3pqdxx3-python3.12-starlette-0.37.2/lib/python3.12/site-packages/starlette/concurrency.py", line 42, in run_in_threadpool
Oct 31 12:22:37 golgi mealie[978592]:     return await anyio.to_thread.run_sync(func, *args)
Oct 31 12:22:37 golgi mealie[978592]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Oct 31 12:22:37 golgi mealie[978592]:   File "/nix/store/202vnh1qhh5ms98izvgd9nfkgjhhvxg2-python3.12-anyio-4.4.0/lib/python3.12/site-packages/anyio/to_thread.py", line 56, in run_sync
Oct 31 12:22:37 golgi mealie[978592]:     return await get_async_backend().run_sync_in_worker_thread(
Oct 31 12:22:37 golgi mealie[978592]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Oct 31 12:22:37 golgi mealie[978592]:   File "/nix/store/202vnh1qhh5ms98izvgd9nfkgjhhvxg2-python3.12-anyio-4.4.0/lib/python3.12/site-packages/anyio/_backends/_asyncio.py", line 2177, in run_sync_in_worker_thread
Oct 31 12:22:37 golgi mealie[978592]:     return await future
Oct 31 12:22:37 golgi mealie[978592]:            ^^^^^^^^^^^^
Oct 31 12:22:37 golgi mealie[978592]:   File "/nix/store/202vnh1qhh5ms98izvgd9nfkgjhhvxg2-python3.12-anyio-4.4.0/lib/python3.12/site-packages/anyio/_backends/_asyncio.py", line 859, in run
Oct 31 12:22:37 golgi mealie[978592]:     result = context.run(func, *args)
Oct 31 12:22:37 golgi mealie[978592]:              ^^^^^^^^^^^^^^^^^^^^^^^^
Oct 31 12:22:37 golgi mealie[978592]:   File "/nix/store/5pb8ggh9dl841h2i507s2vm1nlv2pc19-mealie-2.0.0/lib/python3.12/site-packages/mealie/routes/app/app_about.py", line 24, in get_app_info
Oct 31 12:22:37 golgi mealie[978592]:     default_group = public_repos.groups.get_by_name(settings.DEFAULT_GROUP)
Oct 31 12:22:37 golgi mealie[978592]:                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Oct 31 12:22:37 golgi mealie[978592]:   File "/nix/store/5pb8ggh9dl841h2i507s2vm1nlv2pc19-mealie-2.0.0/lib/python3.12/site-packages/mealie/repos/repository_group.py", line 57, in get_by_name
Oct 31 12:22:37 golgi mealie[978592]:     return self.schema.model_validate(dbgroup)
Oct 31 12:22:37 golgi mealie[978592]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Oct 31 12:22:37 golgi mealie[978592]:   File "/nix/store/84j57ixnz62k673mnd9ysywlvw6bysfm-python3.12-pydantic-2.8.2/lib/python3.12/site-packages/pydantic/main.py", line 568, in model_validate
Oct 31 12:22:37 golgi mealie[978592]:     return cls.__pydantic_validator__.validate_python(
Oct 31 12:22:37 golgi mealie[978592]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Oct 31 12:22:37 golgi mealie[978592]: pydantic_core._pydantic_core.ValidationError: 1 validation error for GroupInDB
Oct 31 12:22:37 golgi mealie[978592]: users.2.household_id
Oct 31 12:22:37 golgi mealie[978592]:   UUID input should be a string, bytes or UUID object [type=uuid_type, input_value=None, input_type=NoneType]
Oct 31 12:22:37 golgi mealie[978592]:     For further information visit https://errors.pydantic.dev/2.8/v/uuid_type

The home/login page then refused to load, I think these logs have something to do with it

Oct 31 12:23:15 golgi mealie[978592]: ERROR    2024-10-31T12:23:15 - Exception in ASGI application
Oct 31 12:23:15 golgi mealie[978592]: Traceback (most recent call last):
Oct 31 12:23:15 golgi mealie[978592]:   File "/nix/store/b2p12s3pf7p04jdpvdlvjpcc7hpnsxhv-python3.12-uvicorn-0.29.0/lib/python3.12/site-packages/uvicorn/protocols/http/h11_impl.py", line 407, in run_asgi
Oct 31 12:23:15 golgi mealie[978592]:     result = await app(  # type: ignore[func-returns-value]
Oct 31 12:23:15 golgi mealie[978592]:              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Oct 31 12:23:15 golgi mealie[978592]:   File "/nix/store/b2p12s3pf7p04jdpvdlvjpcc7hpnsxhv-python3.12-uvicorn-0.29.0/lib/python3.12/site-packages/uvicorn/middleware/proxy_headers.py", line 69, in __call__
Oct 31 12:23:15 golgi mealie[978592]:     return await self.app(scope, receive, send)
Oct 31 12:23:15 golgi mealie[978592]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Oct 31 12:23:15 golgi mealie[978592]:   File "/nix/store/sw6qaw2c535gpcnhrf7nmg8liqp4s63c-python3.12-fastapi-0.112.0/lib/python3.12/site-packages/fastapi/applications.py", line 1054, in __call__
Oct 31 12:23:15 golgi mealie[978592]:     await super().__call__(scope, receive, send)
Oct 31 12:23:15 golgi mealie[978592]:   File "/nix/store/3pbsd13z4x74zi73fb3xp8nbf3pqdxx3-python3.12-starlette-0.37.2/lib/python3.12/site-packages/starlette/applications.py", line 123, in __call__
Oct 31 12:23:15 golgi mealie[978592]:     await self.app(scope, receive, _send)
Oct 31 12:23:15 golgi mealie[978592]:   File "/nix/store/3pbsd13z4x74zi73fb3xp8nbf3pqdxx3-python3.12-starlette-0.37.2/lib/python3.12/site-packages/starlette/middleware/sessions.py", line 85, in __call__
Oct 31 12:23:15 golgi mealie[978592]:     await self.app(scope, receive, send_wrapper)
Oct 31 12:23:15 golgi mealie[978592]:   File "/nix/store/3pbsd13z4x74zi73fb3xp8nbf3pqdxx3-python3.12-starlette-0.37.2/lib/python3.12/site-packages/starlette/middleware/gzip.py", line 24, in __call__
Oct 31 12:23:15 golgi mealie[978592]:     await responder(scope, receive, send)
Oct 31 12:23:15 golgi mealie[978592]:   File "/nix/store/3pbsd13z4x74zi73fb3xp8nbf3pqdxx3-python3.12-starlette-0.37.2/lib/python3.12/site-packages/starlette/middleware/gzip.py", line 44, in __call__
Oct 31 12:23:15 golgi mealie[978592]:     await self.app(scope, receive, self.send_with_gzip)
Oct 31 12:23:15 golgi mealie[978592]:   File "/nix/store/3pbsd13z4x74zi73fb3xp8nbf3pqdxx3-python3.12-starlette-0.37.2/lib/python3.12/site-packages/starlette/middleware/exceptions.py", line 65, in __call__
Oct 31 12:23:15 golgi mealie[978592]:     await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
Oct 31 12:23:15 golgi mealie[978592]:   File "/nix/store/3pbsd13z4x74zi73fb3xp8nbf3pqdxx3-python3.12-starlette-0.37.2/lib/python3.12/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
Oct 31 12:23:15 golgi mealie[978592]:     raise exc
Oct 31 12:23:15 golgi mealie[978592]:   File "/nix/store/3pbsd13z4x74zi73fb3xp8nbf3pqdxx3-python3.12-starlette-0.37.2/lib/python3.12/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
Oct 31 12:23:15 golgi mealie[978592]:     await app(scope, receive, sender)
Oct 31 12:23:15 golgi mealie[978592]:   File "/nix/store/3pbsd13z4x74zi73fb3xp8nbf3pqdxx3-python3.12-starlette-0.37.2/lib/python3.12/site-packages/starlette/routing.py", line 756, in __call__
Oct 31 12:23:15 golgi mealie[978592]:     await self.middleware_stack(scope, receive, send)
Oct 31 12:23:15 golgi mealie[978592]:   File "/nix/store/3pbsd13z4x74zi73fb3xp8nbf3pqdxx3-python3.12-starlette-0.37.2/lib/python3.12/site-packages/starlette/routing.py", line 776, in app
Oct 31 12:23:15 golgi mealie[978592]:     await route.handle(scope, receive, send)
Oct 31 12:23:15 golgi mealie[978592]:   File "/nix/store/3pbsd13z4x74zi73fb3xp8nbf3pqdxx3-python3.12-starlette-0.37.2/lib/python3.12/site-packages/starlette/routing.py", line 297, in handle
Oct 31 12:23:15 golgi mealie[978592]:     await self.app(scope, receive, send)
Oct 31 12:23:15 golgi mealie[978592]:   File "/nix/store/3pbsd13z4x74zi73fb3xp8nbf3pqdxx3-python3.12-starlette-0.37.2/lib/python3.12/site-packages/starlette/routing.py", line 77, in app
Oct 31 12:23:15 golgi mealie[978592]:     await wrap_app_handling_exceptions(app, request)(scope, receive, send)
Oct 31 12:23:15 golgi mealie[978592]:   File "/nix/store/3pbsd13z4x74zi73fb3xp8nbf3pqdxx3-python3.12-starlette-0.37.2/lib/python3.12/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
Oct 31 12:23:15 golgi mealie[978592]:     raise exc
Oct 31 12:23:15 golgi mealie[978592]:   File "/nix/store/3pbsd13z4x74zi73fb3xp8nbf3pqdxx3-python3.12-starlette-0.37.2/lib/python3.12/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
Oct 31 12:23:15 golgi mealie[978592]:     await app(scope, receive, sender)
Oct 31 12:23:15 golgi mealie[978592]:   File "/nix/store/3pbsd13z4x74zi73fb3xp8nbf3pqdxx3-python3.12-starlette-0.37.2/lib/python3.12/site-packages/starlette/routing.py", line 72, in app
Oct 31 12:23:15 golgi mealie[978592]:     response = await func(request)
Oct 31 12:23:15 golgi mealie[978592]:                ^^^^^^^^^^^^^^^^^^^
Oct 31 12:23:15 golgi mealie[978592]:   File "/nix/store/sw6qaw2c535gpcnhrf7nmg8liqp4s63c-python3.12-fastapi-0.112.0/lib/python3.12/site-packages/fastapi/routing.py", line 278, in app
Oct 31 12:23:15 golgi mealie[978592]:     raw_response = await run_endpoint_function(
Oct 31 12:23:15 golgi mealie[978592]:                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Oct 31 12:23:15 golgi mealie[978592]:   File "/nix/store/sw6qaw2c535gpcnhrf7nmg8liqp4s63c-python3.12-fastapi-0.112.0/lib/python3.12/site-packages/fastapi/routing.py", line 191, in run_endpoint_function
Oct 31 12:23:15 golgi mealie[978592]:     return await dependant.call(**values)
Oct 31 12:23:15 golgi mealie[978592]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Oct 31 12:23:15 golgi mealie[978592]:   File "/nix/store/5pb8ggh9dl841h2i507s2vm1nlv2pc19-mealie-2.0.0/lib/python3.12/site-packages/mealie/routes/auth/auth.py", line 122, in oauth_callback
Oct 31 12:23:15 golgi mealie[978592]:     auth = auth_provider.authenticate()
Oct 31 12:23:15 golgi mealie[978592]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Oct 31 12:23:15 golgi mealie[978592]:   File "/nix/store/5pb8ggh9dl841h2i507s2vm1nlv2pc19-mealie-2.0.0/lib/python3.12/site-packages/mealie/core/security/providers/openid_provider.py", line 55, in authenticate
Oct 31 12:23:15 golgi mealie[978592]:     user = self.try_get_user(claims.get(settings.OIDC_USER_CLAIM))
Oct 31 12:23:15 golgi mealie[978592]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Oct 31 12:23:15 golgi mealie[978592]:   File "/nix/store/5pb8ggh9dl841h2i507s2vm1nlv2pc19-mealie-2.0.0/lib/python3.12/site-packages/mealie/core/security/providers/auth_provider.py", line 66, in try_get_user
Oct 31 12:23:15 golgi mealie[978592]:     user = db.users.get_one(username, "email", any_case=True)
Oct 31 12:23:15 golgi mealie[978592]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Oct 31 12:23:15 golgi mealie[978592]:   File "/nix/store/5pb8ggh9dl841h2i507s2vm1nlv2pc19-mealie-2.0.0/lib/python3.12/site-packages/mealie/repos/repository_generic.py", line 162, in get_one
Oct 31 12:23:15 golgi mealie[978592]:     return eff_schema.model_validate(result)
Oct 31 12:23:15 golgi mealie[978592]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Oct 31 12:23:15 golgi mealie[978592]:   File "/nix/store/84j57ixnz62k673mnd9ysywlvw6bysfm-python3.12-pydantic-2.8.2/lib/python3.12/site-packages/pydantic/main.py", line 568, in model_validate
Oct 31 12:23:15 golgi mealie[978592]:     return cls.__pydantic_validator__.validate_python(
Oct 31 12:23:15 golgi mealie[978592]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Oct 31 12:23:15 golgi mealie[978592]: pydantic_core._pydantic_core.ValidationError: 3 validation errors for PrivateUser
Oct 31 12:23:15 golgi mealie[978592]: household
Oct 31 12:23:15 golgi mealie[978592]:   Input should be a valid string [type=string_type, input_value=None, input_type=NoneType]
Oct 31 12:23:15 golgi mealie[978592]:     For further information visit https://errors.pydantic.dev/2.8/v/string_type
Oct 31 12:23:15 golgi mealie[978592]: household_id
Oct 31 12:23:15 golgi mealie[978592]:   UUID input should be a string, bytes or UUID object [type=uuid_type, input_value=None, input_type=NoneType]
Oct 31 12:23:15 golgi mealie[978592]:     For further information visit https://errors.pydantic.dev/2.8/v/uuid_type
Oct 31 12:23:15 golgi mealie[978592]: householdSlug
Oct 31 12:23:15 golgi mealie[978592]:   Field required [type=missing, input_value=<mealie.db.models.users.u...bject at 0x7f3dce8fc3b0>, input_type=User]
Oct 31 12:23:15 golgi mealie[978592]:     For further information visit https://errors.pydantic.dev/2.8/v/missing

Now upon trying to restart the service:

Oct 31 12:37:07 golgi systemd[1]: Starting Mealie, a self hosted recipe manager and meal planner...
Oct 31 12:37:09 golgi init_db[1401012]: WARNING  2024-10-31T12:37:09 - Secrets directory '/run/secrets' does not exist
Oct 31 12:37:09 golgi init_db[1401012]: WARNING  2024-10-31T12:37:09 - Secrets directory '/run/secrets' does not exist
Oct 31 12:37:09 golgi init_db[1401012]: DEBUG    2024-10-31T12:37:09 - Starting new HTTPS connection (1): github.com:443
Oct 31 12:37:09 golgi init_db[1401012]: DEBUG    2024-10-31T12:37:09 - https://github.com:443 "GET /mealie-recipes/nlp-model/releases/download/v1.0.0/model.crfmodel HTTP/11" 302 0
Oct 31 12:37:09 golgi init_db[1401012]: DEBUG    2024-10-31T12:37:09 - Starting new HTTPS connection (1): objects.githubusercontent.com:443
Oct 31 12:37:09 golgi init_db[1401012]: DEBUG    2024-10-31T12:37:09 - https://objects.githubusercontent.com:443 "GET /github-production-release-asset-2e65be/415123865/9136157b-d98c-46dd-89d5-ffdcdae4bfa0?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=releaseassetprodu>
Oct 31 12:37:10 golgi init_db[1401013]: WARNING  2024-10-31T12:37:10 - Secrets directory '/run/secrets' does not exist
Oct 31 12:37:10 golgi init_db[1401013]: WARNING  2024-10-31T12:37:10 - Secrets directory '/run/secrets' does not exist
Oct 31 12:37:12 golgi init_db[1401013]: INFO     2024-10-31T12:37:12 - Database connection established.
Oct 31 12:37:12 golgi init_db[1401013]: INFO     2024-10-31T12:37:12 - Context impl PostgresqlImpl.
Oct 31 12:37:12 golgi init_db[1401013]: INFO     2024-10-31T12:37:12 - Will assume transactional DDL.
Oct 31 12:37:12 golgi init_db[1401013]: DEBUG    2024-10-31T12:37:12 - Migration not needed.
Oct 31 12:37:12 golgi init_db[1401013]: INFO     2024-10-31T12:37:12 - Checking for migration data fixes
Oct 31 12:37:12 golgi init_db[1401013]: DEBUG    2024-10-31T12:37:12 - No food found with slug: 'dairy-products-and-dairy-substitutes' skipping fix
Oct 31 12:37:12 golgi init_db[1401013]: DEBUG    2024-10-31T12:37:12 - No group found with an empty name; skipping fix
Oct 31 12:37:12 golgi init_db[1401013]: Traceback (most recent call last):
Oct 31 12:37:12 golgi init_db[1401013]:   File "/nix/store/5pb8ggh9dl841h2i507s2vm1nlv2pc19-mealie-2.0.0/lib/python3.12/site-packages/mealie/db/init_db.py", line 132, in <module>
Oct 31 12:37:12 golgi init_db[1401013]:     main()
Oct 31 12:37:12 golgi init_db[1401013]:   File "/nix/store/5pb8ggh9dl841h2i507s2vm1nlv2pc19-mealie-2.0.0/lib/python3.12/site-packages/mealie/db/init_db.py", line 124, in main
Oct 31 12:37:12 golgi init_db[1401013]:     if db.users.get_all():
Oct 31 12:37:12 golgi init_db[1401013]:        ^^^^^^^^^^^^^^^^^^
Oct 31 12:37:12 golgi init_db[1401013]:   File "/nix/store/5pb8ggh9dl841h2i507s2vm1nlv2pc19-mealie-2.0.0/lib/python3.12/site-packages/mealie/repos/repository_generic.py", line 105, in get_all
Oct 31 12:37:12 golgi init_db[1401013]:     results = self.page_all(pq, override=override)
Oct 31 12:37:12 golgi init_db[1401013]:               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Oct 31 12:37:12 golgi init_db[1401013]:   File "/nix/store/5pb8ggh9dl841h2i507s2vm1nlv2pc19-mealie-2.0.0/lib/python3.12/site-packages/mealie/repos/repository_generic.py", line 337, in page_all
Oct 31 12:37:12 golgi init_db[1401013]:     items=[eff_schema.model_validate(s) for s in data],
Oct 31 12:37:12 golgi init_db[1401013]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Oct 31 12:37:12 golgi init_db[1401013]:   File "/nix/store/84j57ixnz62k673mnd9ysywlvw6bysfm-python3.12-pydantic-2.8.2/lib/python3.12/site-packages/pydantic/main.py", line 568, in model_validate
Oct 31 12:37:12 golgi init_db[1401013]:     return cls.__pydantic_validator__.validate_python(
Oct 31 12:37:12 golgi init_db[1401013]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Oct 31 12:37:12 golgi init_db[1401013]: pydantic_core._pydantic_core.ValidationError: 3 validation errors for PrivateUser
Oct 31 12:37:12 golgi init_db[1401013]: household
Oct 31 12:37:12 golgi init_db[1401013]:   Input should be a valid string [type=string_type, input_value=None, input_type=NoneType]
Oct 31 12:37:12 golgi init_db[1401013]:     For further information visit https://errors.pydantic.dev/2.8/v/string_type
Oct 31 12:37:12 golgi init_db[1401013]: household_id
Oct 31 12:37:12 golgi init_db[1401013]:   UUID input should be a string, bytes or UUID object [type=uuid_type, input_value=None, input_type=NoneType]
Oct 31 12:37:12 golgi init_db[1401013]:     For further information visit https://errors.pydantic.dev/2.8/v/uuid_type
Oct 31 12:37:12 golgi init_db[1401013]: householdSlug
Oct 31 12:37:12 golgi init_db[1401013]:   Field required [type=missing, input_value=<mealie.db.models.users.u...bject at 0x7f30c1efbd10>, input_type=User]
Oct 31 12:37:12 golgi init_db[1401013]:     For further information visit https://errors.pydantic.dev/2.8/v/missing
Oct 31 12:37:12 golgi systemd[1]: mealie.service: Control process exited, code=exited, status=1/FAILURE
Oct 31 12:37:12 golgi systemd[1]: mealie.service: Failed with result 'exit-code'.
Oct 31 12:37:12 golgi systemd[1]: Failed to start Mealie, a self hosted recipe manager and meal planner.

Mealie Version

v2.0.0, running on NixOS

Deployment

Other (please specify below)

Additional Deployment Details

Linux, NixOS

@tecosaur tecosaur added bug Something isn't working triage labels Oct 31, 2024
@tecosaur
Copy link
Author

Separately to whatever bug lead to this, I'd be hugely appreciative if anyone could help me get Mealie up and running again (via DB edits, I'd think). It's not great having Mealie out of action entirely.

@michael-genson
Copy link
Collaborator

I'm not familiar enough with the OAuth implementation to help with the actual issue (@cmintey ?), but in terms of fixing things to get Mealie running again, make sure all users have a valid household_id (it's probably only that one new user that doesn't)

Specifically, in the users table, household_id needs to be a valid UUID (which you can find in the households table)

@tecosaur
Copy link
Author

That worked! Looking at the users table, the newest user looked just like the others (which were also registered via OAuth, BTW) except for a blank household_id.

Fixed with UPDATE users SET household_id = '<uuid>' WHERE username = '<name>';

Many thanks!

@cmintey
Copy link
Contributor

cmintey commented Oct 31, 2024

@michael-genson i don't understand why the user is being created when there is a validation error... I think we should add a "is default" flag to the group and household models instead of having env variables. Plus that would allow for admins to have a different default household per group

@cmintey
Copy link
Contributor

cmintey commented Oct 31, 2024

@tecosaur to prevent this in the meantime, you should have a DEFAULT_HOUSEHOLD env variable, and it should be set to the name of a valid household within the default group

@tecosaur
Copy link
Author

Ah, so this might have been caused by me renaming the default household before this user tried logging in?

@tecosaur
Copy link
Author

Also, I tried creating a new household "Unsorted" to avoid this for now on the /admin/manage/households page, but that seems to have it's own bug 😅

Oct 31 17:45:29 golgi mealie[1418194]: INFO     2024-10-31T17:45:29 - [172.68.0.220:0] 422 Unprocessable Entity "POST /api/admin/households HTTP/1.1"

@cmintey
Copy link
Contributor

cmintey commented Oct 31, 2024

Ah, so this might have been caused by me renaming the default household before this user tried logging in?

Yeah, that would definitely do it. But it should just throw an error, not actually create the user!

@michael-genson
Copy link
Collaborator

michael-genson commented Oct 31, 2024

i don't understand why the user is being created when there is a validation error

Same, must be some weird edge case

I think we should add a "is default" flag to the group and household models instead of having env variables

Yeah I think that's a good idea. I can take a look at that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug: confirmed bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants