rommapp / romm

A beautiful, powerful, self-hosted rom manager
https://romm.app
GNU Affero General Public License v3.0
2.34k stars 95 forks source link

Error when loading platform with new roms #1207

Open paulmorabito opened 1 month ago

paulmorabito commented 1 month ago

Running latest Romm on docker in Unraid. Somehow managed to lose some of my ROMs for certain platforms. When I visit the platform page in Romm I get the below error. Trying to rescan all and only that platform doesn't fix the issue. There seems to be an issue with one of the games (listed in the error).

Thanks in advance.

2024-09-23 02:22:43 -0700] [1066] [ERROR] Exception in ASGI application
  + Exception Group Traceback (most recent call last):
  |   File "/src/.venv/lib/python3.12/site-packages/starlette/_utils.py", line 87, in collapse_excgroups
  |     yield
  |   File "/src/.venv/lib/python3.12/site-packages/starlette/middleware/base.py", line 190, in __call__
  |     async with anyio.create_task_group() as task_group:
  |   File "/src/.venv/lib/python3.12/site-packages/anyio/_backends/_asyncio.py", line 680, in __aexit__
  |     raise BaseExceptionGroup(
  | ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception)
  +-+---------------- 1 ----------------
    | Traceback (most recent call last):
    |   File "/src/.venv/lib/python3.12/site-packages/uvicorn/protocols/http/h11_impl.py", line 407, in run_asgi
    |     result = await app(  # type: ignore[func-returns-value]
    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "/src/.venv/lib/python3.12/site-packages/uvicorn/middleware/proxy_headers.py", line 69, in __call__
    |     return await self.app(scope, receive, send)
    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "/src/.venv/lib/python3.12/site-packages/fastapi/applications.py", line 1054, in __call__
    |     await super().__call__(scope, receive, send)
    |   File "/src/.venv/lib/python3.12/site-packages/starlette/applications.py", line 123, in __call__
    |     await self.middleware_stack(scope, receive, send)
    |   File "/src/.venv/lib/python3.12/site-packages/starlette/middleware/errors.py", line 186, in __call__
    |     raise exc
    |   File "/src/.venv/lib/python3.12/site-packages/starlette/middleware/errors.py", line 164, in __call__
    |     await self.app(scope, receive, _send)
    |   File "/src/.venv/lib/python3.12/site-packages/starlette/middleware/base.py", line 189, in __call__
    |     with collapse_excgroups():
    |   File "/usr/lib/python3.12/contextlib.py", line 158, in __exit__
    |     self.gen.throw(value)
    |   File "/src/.venv/lib/python3.12/site-packages/starlette/_utils.py", line 93, in collapse_excgroups
    |     raise exc
    |   File "/src/.venv/lib/python3.12/site-packages/starlette/middleware/base.py", line 191, in __call__
    |     response = await self.dispatch_func(request, call_next)
    |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "/backend/utils/context.py", line 41, in set_context_middleware
    |     return await call_next(request)
    |            ^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "/src/.venv/lib/python3.12/site-packages/starlette/middleware/base.py", line 165, in call_next
    |     raise app_exc
    |   File "/src/.venv/lib/python3.12/site-packages/starlette/middleware/base.py", line 151, in coro
    |     await self.app(scope, receive_or_disconnect, send_no_error)
    |   File "/backend/handler/auth/middleware.py", line 146, in __call__
    |     await self.app(scope, receive, send_wrapper)
    |   File "/src/.venv/lib/python3.12/site-packages/starlette/middleware/authentication.py", line 48, in __call__
    |     await self.app(scope, receive, send)
    |   File "/backend/handler/auth/middleware.py", line 19, in __call__
    |     await super().__call__(scope, receive, send)
    |   File "/src/.venv/lib/python3.12/site-packages/starlette_csrf/middleware.py", line 72, in __call__
    |     await self.app(scope, receive, send)
    |   File "/src/.venv/lib/python3.12/site-packages/starlette/middleware/cors.py", line 83, in __call__
    |     await self.app(scope, receive, send)
    |   File "/src/.venv/lib/python3.12/site-packages/starlette/middleware/exceptions.py", line 62, in __call__
    |     await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
    |   File "/src/.venv/lib/python3.12/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
    |     raise exc
    |   File "/src/.venv/lib/python3.12/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
    |     await app(scope, receive, sender)
    |   File "/src/.venv/lib/python3.12/site-packages/starlette/routing.py", line 758, in __call__
    |     await self.middleware_stack(scope, receive, send)
    |   File "/src/.venv/lib/python3.12/site-packages/starlette/routing.py", line 778, in app
    |     await route.handle(scope, receive, send)
    |   File "/src/.venv/lib/python3.12/site-packages/starlette/routing.py", line 299, in handle
    |     await self.app(scope, receive, send)
    |   File "/src/.venv/lib/python3.12/site-packages/starlette/routing.py", line 79, in app
    |     await wrap_app_handling_exceptions(app, request)(scope, receive, send)
    |   File "/src/.venv/lib/python3.12/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
    |     raise exc
    |   File "/src/.venv/lib/python3.12/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
    |     await app(scope, receive, sender)
    |   File "/src/.venv/lib/python3.12/site-packages/starlette/routing.py", line 74, in app
    |     response = await func(request)
    |                ^^^^^^^^^^^^^^^^^^^
    |   File "/src/.venv/lib/python3.12/site-packages/fastapi/routing.py", line 278, in app
    |     raw_response = await run_endpoint_function(
    |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "/src/.venv/lib/python3.12/site-packages/fastapi/routing.py", line 193, in run_endpoint_function
    |     return await run_in_threadpool(dependant.call, **values)
    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "/src/.venv/lib/python3.12/site-packages/starlette/concurrency.py", line 42, in run_in_threadpool
    |     return await anyio.to_thread.run_sync(func, *args)
    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "/src/.venv/lib/python3.12/site-packages/anyio/to_thread.py", line 56, in run_sync
    |     return await get_async_backend().run_sync_in_worker_thread(
    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "/src/.venv/lib/python3.12/site-packages/anyio/_backends/_asyncio.py", line 2177, in run_sync_in_worker_thread
    |     return await future
    |            ^^^^^^^^^^^^
    |   File "/src/.venv/lib/python3.12/site-packages/anyio/_backends/_asyncio.py", line 859, in run
    |     result = context.run(func, *args)
    |              ^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "/src/.venv/lib/python3.12/site-packages/starlette/authentication.py", line 104, in sync_wrapper
    |     return func(*args, **kwargs)
    |            ^^^^^^^^^^^^^^^^^^^^^
    |   File "/backend/endpoints/rom.py", line 129, in get_roms
    |     return [SimpleRomSchema.from_orm_with_request(rom, request) for rom in roms]
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "/backend/endpoints/responses/rom.py", line 138, in from_orm_with_request
    |     rom = cls.model_validate(db_rom)
    |           ^^^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "/src/.venv/lib/python3.12/site-packages/pydantic/main.py", line 568, in model_validate
    |     return cls.__pydantic_validator__.validate_python(
    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | pydantic_core._pydantic_core.ValidationError: 10 validation errors for SimpleRomSchema
    | files.0
    |   Input should be a valid dictionary [type=dict_type, input_value='METAL GEAR SOLID 1 - Mas...00C1301A9C2000][v0].nsp', input_type=str]
    |     For further information visit https://errors.pydantic.dev/2.8/v/dict_type
    | files.1
    |   Input should be a valid dictionary [type=dict_type, input_value='METAL GEAR SOLID 1 - Mas...01A9C2800][v262144].nsp', input_type=str]
    |     For further information visit https://errors.pydantic.dev/2.8/v/dict_type
    | files.2
    |   Input should be a valid dictionary [type=dict_type, input_value='METAL GEAR SOLID 1 - Mas...00C1301A9C3001][v0].nsp', input_type=str]
    |     For further information visit https://errors.pydantic.dev/2.8/v/dict_type
    | files.3
    |   Input should be a valid dictionary [type=dict_type, input_value='METAL GEAR SOLID 1 - Mas...00C1301A9C3002][v0].nsp', input_type=str]
    |     For further information visit https://errors.pydantic.dev/2.8/v/dict_type
    | files.4
    |   Input should be a valid dictionary [type=dict_type, input_value='METAL GEAR SOLID 2 Sons ...0C800][v327680][US].nsp', input_type=str]
    |     For further information visit https://errors.pydantic.dev/2.8/v/dict_type
    | files.5
    |   Input should be a valid dictionary [type=dict_type, input_value='METAL GEAR SOLID 2 Sons ...301AA0C000][v0][US].nsp', input_type=str]
    |     For further information visit https://errors.pydantic.dev/2.8/v/dict_type
    | files.6
    |   Input should be a valid dictionary [type=dict_type, input_value='METAL GEAR SOLID 2 Sons ...00A4301AA0D001][v0].nsp', input_type=str]
    |     For further information visit https://errors.pydantic.dev/2.8/v/dict_type
    | files.7
    |   Input should be a valid dictionary [type=dict_type, input_value='METAL GEAR SOLID 3 Snake...F01AA10000][v0][US].nsp', input_type=str]
    |     For further information visit https://errors.pydantic.dev/2.8/v/dict_type
    | files.8
    |   Input should be a valid dictionary [type=dict_type, input_value='METAL GEAR SOLID 3 Snake...10800][v393216][US].nsp', input_type=str]
    |     For further information visit https://errors.pydantic.dev/2.8/v/dict_type
    | files.9
    |   Input should be a valid dictionary [type=dict_type, input_value='METAL GEAR SOLID 3 Snake...F01AA11001[[v0][US].nsp', input_type=str]
    |     For further information visit https://errors.pydantic.dev/2.8/v/dict_type
    +------------------------------------

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/src/.venv/lib/python3.12/site-packages/uvicorn/protocols/http/h11_impl.py", line 407, in run_asgi
    result = await app(  # type: ignore[func-returns-value]
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/src/.venv/lib/python3.12/site-packages/uvicorn/middleware/proxy_headers.py", line 69, in __call__
    return await self.app(scope, receive, send)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/src/.venv/lib/python3.12/site-packages/fastapi/applications.py", line 1054, in __call__
    await super().__call__(scope, receive, send)
  File "/src/.venv/lib/python3.12/site-packages/starlette/applications.py", line 123, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/src/.venv/lib/python3.12/site-packages/starlette/middleware/errors.py", line 186, in __call__
    raise exc
  File "/src/.venv/lib/python3.12/site-packages/starlette/middleware/errors.py", line 164, in __call__
    await self.app(scope, receive, _send)
  File "/src/.venv/lib/python3.12/site-packages/starlette/middleware/base.py", line 189, in __call__
    with collapse_excgroups():
  File "/usr/lib/python3.12/contextlib.py", line 158, in __exit__
    self.gen.throw(value)
  File "/src/.venv/lib/python3.12/site-packages/starlette/_utils.py", line 93, in collapse_excgroups
    raise exc
  File "/src/.venv/lib/python3.12/site-packages/starlette/middleware/base.py", line 191, in __call__
    response = await self.dispatch_func(request, call_next)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/backend/utils/context.py", line 41, in set_context_middleware
    return await call_next(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/src/.venv/lib/python3.12/site-packages/starlette/middleware/base.py", line 165, in call_next
    raise app_exc
  File "/src/.venv/lib/python3.12/site-packages/starlette/middleware/base.py", line 151, in coro
    await self.app(scope, receive_or_disconnect, send_no_error)
  File "/backend/handler/auth/middleware.py", line 146, in __call__
    await self.app(scope, receive, send_wrapper)
  File "/src/.venv/lib/python3.12/site-packages/starlette/middleware/authentication.py", line 48, in __call__
    await self.app(scope, receive, send)
  File "/backend/handler/auth/middleware.py", line 19, in __call__
    await super().__call__(scope, receive, send)
  File "/src/.venv/lib/python3.12/site-packages/starlette_csrf/middleware.py", line 72, in __call__
    await self.app(scope, receive, send)
  File "/src/.venv/lib/python3.12/site-packages/starlette/middleware/cors.py", line 83, in __call__
    await self.app(scope, receive, send)
  File "/src/.venv/lib/python3.12/site-packages/starlette/middleware/exceptions.py", line 62, in __call__
    await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
  File "/src/.venv/lib/python3.12/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
    raise exc
  File "/src/.venv/lib/python3.12/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
    await app(scope, receive, sender)
  File "/src/.venv/lib/python3.12/site-packages/starlette/routing.py", line 758, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/src/.venv/lib/python3.12/site-packages/starlette/routing.py", line 778, in app
    await route.handle(scope, receive, send)
  File "/src/.venv/lib/python3.12/site-packages/starlette/routing.py", line 299, in handle
    await self.app(scope, receive, send)
  File "/src/.venv/lib/python3.12/site-packages/starlette/routing.py", line 79, in app
    await wrap_app_handling_exceptions(app, request)(scope, receive, send)
  File "/src/.venv/lib/python3.12/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
    raise exc
  File "/src/.venv/lib/python3.12/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
    await app(scope, receive, sender)
  File "/src/.venv/lib/python3.12/site-packages/starlette/routing.py", line 74, in app
    response = await func(request)
               ^^^^^^^^^^^^^^^^^^^
  File "/src/.venv/lib/python3.12/site-packages/fastapi/routing.py", line 278, in app
    raw_response = await run_endpoint_function(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/src/.venv/lib/python3.12/site-packages/fastapi/routing.py", line 193, in run_endpoint_function
    return await run_in_threadpool(dependant.call, **values)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/src/.venv/lib/python3.12/site-packages/starlette/concurrency.py", line 42, in run_in_threadpool
    return await anyio.to_thread.run_sync(func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/src/.venv/lib/python3.12/site-packages/anyio/to_thread.py", line 56, in run_sync
    return await get_async_backend().run_sync_in_worker_thread(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/src/.venv/lib/python3.12/site-packages/anyio/_backends/_asyncio.py", line 2177, in run_sync_in_worker_thread
    return await future
           ^^^^^^^^^^^^
  File "/src/.venv/lib/python3.12/site-packages/anyio/_backends/_asyncio.py", line 859, in run
    result = context.run(func, *args)
             ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/src/.venv/lib/python3.12/site-packages/starlette/authentication.py", line 104, in sync_wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/backend/endpoints/rom.py", line 129, in get_roms
    return [SimpleRomSchema.from_orm_with_request(rom, request) for rom in roms]
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/backend/endpoints/responses/rom.py", line 138, in from_orm_with_request
    rom = cls.model_validate(db_rom)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/src/.venv/lib/python3.12/site-packages/pydantic/main.py", line 568, in model_validate
    return cls.__pydantic_validator__.validate_python(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pydantic_core._pydantic_core.ValidationError: 10 validation errors for SimpleRomSchema
files.0
  Input should be a valid dictionary [type=dict_type, input_value='METAL GEAR SOLID 1 - Mas...00C1301A9C2000][v0].nsp', input_type=str]
    For further information visit https://errors.pydantic.dev/2.8/v/dict_type
files.1
  Input should be a valid dictionary [type=dict_type, input_value='METAL GEAR SOLID 1 - Mas...01A9C2800][v262144].nsp', input_type=str]
    For further information visit https://errors.pydantic.dev/2.8/v/dict_type
files.2
  Input should be a valid dictionary [type=dict_type, input_value='METAL GEAR SOLID 1 - Mas...00C1301A9C3001][v0].nsp', input_type=str]
    For further information visit https://errors.pydantic.dev/2.8/v/dict_type
files.3
  Input should be a valid dictionary [type=dict_type, input_value='METAL GEAR SOLID 1 - Mas...00C1301A9C3002][v0].nsp', input_type=str]
    For further information visit https://errors.pydantic.dev/2.8/v/dict_type
files.4
  Input should be a valid dictionary [type=dict_type, input_value='METAL GEAR SOLID 2 Sons ...0C800][v327680][US].nsp', input_type=str]
    For further information visit https://errors.pydantic.dev/2.8/v/dict_type
files.5
  Input should be a valid dictionary [type=dict_type, input_value='METAL GEAR SOLID 2 Sons ...301AA0C000][v0][US].nsp', input_type=str]
    For further information visit https://errors.pydantic.dev/2.8/v/dict_type
files.6
  Input should be a valid dictionary [type=dict_type, input_value='METAL GEAR SOLID 2 Sons ...00A4301AA0D001][v0].nsp', input_type=str]
    For further information visit https://errors.pydantic.dev/2.8/v/dict_type
files.7
  Input should be a valid dictionary [type=dict_type, input_value='METAL GEAR SOLID 3 Snake...F01AA10000][v0][US].nsp', input_type=str]
    For further information visit https://errors.pydantic.dev/2.8/v/dict_type
files.8
  Input should be a valid dictionary [type=dict_type, input_value='METAL GEAR SOLID 3 Snake...10800][v393216][US].nsp', input_type=str]
    For further information visit https://errors.pydantic.dev/2.8/v/dict_type
files.9
  Input should be a valid dictionary [type=dict_type, input_value='METAL GEAR SOLID 3 Snake...F01AA11001[[v0][US].nsp', input_type=str]
    For further information visit https://errors.pydantic.dev/2.8/v/dict_type
192.168.1.131:0 - "GET /api/collections HTTP/1.0" 20
gantoine commented 1 month ago

Run a quick scan from the /scan page, should fix everything.

paulmorabito commented 1 month ago

I tried already. It said no new or changed files detected but the error persists and it shows a non zero count of roms when i see it listed on the roms page.

INFO:     [RomM][2024-09-23 11:50:44] Found 1 platforms in file system 
INFO:     [RomM][2024-09-23 11:50:44] · xx
INFO:     [RomM][2024-09-23 11:50:45]   Identified as xx
WARNING:  [RomM][2024-09-23 11:50:45]   ⚠️ No firmware found, skipping firmware scan for this platform
WARNING:  [RomM][2024-09-23 11:50:45]   ⚠️ No roms found, verify that the folder structure is correct
INFO:     [RomM][2024-09-23 11:50:45] ✔️ Scan completed