Skip to content

开启复选框识别后出错:Failed to process file: 'original_label' #17

@ZenCoderWu

Description

@ZenCoderWu
Image

错误日志如下:

2025-12-02 01:11:33.656 | ERROR    | __main__:file_parse:347 - 'original_label'
Traceback (most recent call last):

  File "/app/app.py", line 358, in <module>
    uvicorn.run(app, host="0.0.0.0", port=8888)
    │       │   └ <fastapi.applications.FastAPI object at 0x7f843e6b34f0>
    │       └ <function run at 0x7f843d811d80>
    └ <module 'uvicorn' from '/usr/local/lib/python3.10/site-packages/uvicorn/__init__.py'>

  File "/usr/local/lib/python3.10/site-packages/uvicorn/main.py", line 593, in run
    server.run()
    │      └ <function Server.run at 0x7f843d7e1510>
    └ <uvicorn.server.Server object at 0x7f843c5c87c0>
  File "/usr/local/lib/python3.10/site-packages/uvicorn/server.py", line 67, in run
    return asyncio_run(self.serve(sockets=sockets), loop_factory=self.config.get_loop_factory())
           │           │    │             │                      │    │      └ <function Config.get_loop_factory at 0x7f843d768dc0>
           │           │    │             │                      │    └ <uvicorn.config.Config object at 0x7f843c5c8250>
           │           │    │             │                      └ <uvicorn.server.Server object at 0x7f843c5c87c0>
           │           │    │             └ None
           │           │    └ <function Server.serve at 0x7f843d7e15a0>
           │           └ <uvicorn.server.Server object at 0x7f843c5c87c0>
           └ <function asyncio_run at 0x7f843d98ff40>
  File "/usr/local/lib/python3.10/site-packages/uvicorn/_compat.py", line 60, in asyncio_run
    return loop.run_until_complete(main)
           │    │                  └ <coroutine object Server.serve at 0x7f8405bb6490>
           │    └ <cyfunction Loop.run_until_complete at 0x7f8405cff340>
           └ <uvloop.Loop running=True closed=False debug=False>
  File "/usr/local/lib/python3.10/site-packages/uvicorn/protocols/http/httptools_impl.py", line 409, in run_asgi
    result = await app(  # type: ignore[func-returns-value]
                   └ <uvicorn.middleware.proxy_headers.ProxyHeadersMiddleware object at 0x7f843c600910>
  File "/usr/local/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in __call__
    return await self.app(scope, receive, send)
                 │    │   │      │        └ <bound method RequestResponseCycle.send of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7f843c68a8...
                 │    │   │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7f843c6...
                 │    │   └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('172.19.0.3', 8888), 'c...
                 │    └ <fastapi.applications.FastAPI object at 0x7f843e6b34f0>
                 └ <uvicorn.middleware.proxy_headers.ProxyHeadersMiddleware object at 0x7f843c600910>
  File "/usr/local/lib/python3.10/site-packages/fastapi/applications.py", line 1134, in __call__
    await super().__call__(scope, receive, send)
                           │      │        └ <bound method RequestResponseCycle.send of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7f843c68a8...
                           │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7f843c6...
                           └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('172.19.0.3', 8888), 'c...
  File "/usr/local/lib/python3.10/site-packages/starlette/applications.py", line 107, in __call__
    await self.middleware_stack(scope, receive, send)
          │    │                │      │        └ <bound method RequestResponseCycle.send of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7f843c68a8...
          │    │                │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7f843c6...
          │    │                └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('172.19.0.3', 8888), 'c...
          │    └ <starlette.middleware.errors.ServerErrorMiddleware object at 0x7f843c689e10>
          └ <fastapi.applications.FastAPI object at 0x7f843e6b34f0>
  File "/usr/local/lib/python3.10/site-packages/starlette/middleware/errors.py", line 164, in __call__
    await self.app(scope, receive, _send)
          │    │   │      │        └ <function ServerErrorMiddleware.__call__.<locals>._send at 0x7f828027aa70>
          │    │   │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7f843c6...
          │    │   └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('172.19.0.3', 8888), 'c...
          │    └ <starlette.middleware.gzip.GZipMiddleware object at 0x7f843c689ea0>
          └ <starlette.middleware.errors.ServerErrorMiddleware object at 0x7f843c689e10>
  File "/usr/local/lib/python3.10/site-packages/starlette/middleware/gzip.py", line 29, in __call__
    await responder(scope, receive, send)
          │         │      │        └ <function ServerErrorMiddleware.__call__.<locals>._send at 0x7f828027aa70>
          │         │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7f843c6...
          │         └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('172.19.0.3', 8888), 'c...
          └ <starlette.middleware.gzip.GZipResponder object at 0x7f843c68ada0>
  File "/usr/local/lib/python3.10/site-packages/starlette/middleware/gzip.py", line 130, in __call__
    await super().__call__(scope, receive, send)
                           │      │        └ <function ServerErrorMiddleware.__call__.<locals>._send at 0x7f828027aa70>
                           │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7f843c6...
                           └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('172.19.0.3', 8888), 'c...
  File "/usr/local/lib/python3.10/site-packages/starlette/middleware/gzip.py", line 46, in __call__
    await self.app(scope, receive, self.send_with_compression)
          │    │   │      │        │    └ <function IdentityResponder.send_with_compression at 0x7f843c6abe20>
          │    │   │      │        └ <starlette.middleware.gzip.GZipResponder object at 0x7f843c68ada0>
          │    │   │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7f843c6...
          │    │   └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('172.19.0.3', 8888), 'c...
          │    └ <starlette.middleware.exceptions.ExceptionMiddleware object at 0x7f843c689ed0>
          └ <starlette.middleware.gzip.GZipResponder object at 0x7f843c68ada0>
  File "/usr/local/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 63, in __call__
    await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
          │                            │    │    │     │      │        └ <bound method IdentityResponder.send_with_compression of <starlette.middleware.gzip.GZipResponder object at 0x7f843c68ada0>>
          │                            │    │    │     │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7f843c6...
          │                            │    │    │     └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('172.19.0.3', 8888), 'c...
          │                            │    │    └ <starlette.requests.Request object at 0x7f843c689960>
          │                            │    └ <fastapi.middleware.asyncexitstack.AsyncExitStackMiddleware object at 0x7f843c689f30>
          │                            └ <starlette.middleware.exceptions.ExceptionMiddleware object at 0x7f843c689ed0>
          └ <function wrap_app_handling_exceptions at 0x7f843c7da710>
  File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
    await app(scope, receive, sender)
          │   │      │        └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x7f840fb2b010>
          │   │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7f843c6...
          │   └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('172.19.0.3', 8888), 'c...
          └ <fastapi.middleware.asyncexitstack.AsyncExitStackMiddleware object at 0x7f843c689f30>
  File "/usr/local/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
    await self.app(scope, receive, send)
          │    │   │      │        └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x7f840fb2b010>
          │    │   │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7f843c6...
          │    │   └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('172.19.0.3', 8888), 'c...
          │    └ <fastapi.routing.APIRouter object at 0x7f843c2b2fb0>
          └ <fastapi.middleware.asyncexitstack.AsyncExitStackMiddleware object at 0x7f843c689f30>
  File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 716, in __call__
    await self.middleware_stack(scope, receive, send)
          │    │                │      │        └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x7f840fb2b010>
          │    │                │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7f843c6...
          │    │                └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('172.19.0.3', 8888), 'c...
          │    └ <bound method Router.app of <fastapi.routing.APIRouter object at 0x7f843c2b2fb0>>
          └ <fastapi.routing.APIRouter object at 0x7f843c2b2fb0>
  File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 736, in app
    await route.handle(scope, receive, send)
          │     │      │      │        └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x7f840fb2b010>
          │     │      │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7f843c6...
          │     │      └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('172.19.0.3', 8888), 'c...
          │     └ <function Route.handle at 0x7f843c7dbc70>
          └ APIRoute(path='/file_parse', name='file_parse', methods=['POST'])
  File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 290, in handle
    await self.app(scope, receive, send)
          │    │   │      │        └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x7f840fb2b010>
          │    │   │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7f843c6...
          │    │   └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('172.19.0.3', 8888), 'c...
          │    └ <function request_response.<locals>.app at 0x7f8405c8dcf0>
          └ APIRoute(path='/file_parse', name='file_parse', methods=['POST'])
  File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 125, in app
    await wrap_app_handling_exceptions(app, request)(scope, receive, send)
          │                            │    │        │      │        └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x7f840fb2b010>
          │                            │    │        │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7f843c6...
          │                            │    │        └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('172.19.0.3', 8888), 'c...
          │                            │    └ <starlette.requests.Request object at 0x7f7f725b71c0>
          │                            └ <function request_response.<locals>.app.<locals>.app at 0x7f840fb2bd00>
          └ <function wrap_app_handling_exceptions at 0x7f843c7da710>
  File "/usr/local/lib/python3.10/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
    await app(scope, receive, sender)
          │   │      │        └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x7f7f700b0700>
          │   │      └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.httptools_impl.RequestResponseCycle object at 0x7f843c6...
          │   └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('172.19.0.3', 8888), 'c...
          └ <function request_response.<locals>.app.<locals>.app at 0x7f840fb2bd00>
  File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 111, in app
    response = await f(request)
                     │ └ <starlette.requests.Request object at 0x7f7f725b71c0>
                     └ <function get_request_handler.<locals>.app at 0x7f8405c8dbd0>
  File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 391, in app
    raw_response = await run_endpoint_function(
                         └ <function run_endpoint_function at 0x7f843c889900>
  File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 290, in run_endpoint_function
    return await dependant.call(**values)
                 │         │      └ {'files': [UploadFile(filename='ScreenShot_2025-12-02_090947_282.png', size=739694, headers=Headers({'content-disposition': '...
                 │         └ <function file_parse at 0x7f8405c8ca60>
                 └ Dependant(path_params=[], query_params=[], header_params=[], cookie_params=[], body_params=[ModelField(field_info=File(Pydant...

> File "/app/app.py", line 229, in file_parse
    await aio_do_parse(
          └ <function aio_do_parse at 0x7f8405c8c040>

  File "/usr/local/lib/python3.10/site-packages/rapid_doc/cli/common.py", line 287, in aio_do_parse
    _process_pipeline(
    └ <function _process_pipeline at 0x7f8405c8beb0>
  File "/usr/local/lib/python3.10/site-packages/rapid_doc/cli/common.py", line 200, in _process_pipeline
    middle_json = pipeline_result_to_middle_json(
                  └ <function result_to_middle_json at 0x7f83f1259630>
  File "/usr/local/lib/python3.10/site-packages/rapid_doc/backend/pipeline/model_json_to_middle_json.py", line 186, in result_to_middle_json
    page_info = page_model_info_to_page_info(
                └ <function page_model_info_to_page_info at 0x7f83fac94040>
  File "/usr/local/lib/python3.10/site-packages/rapid_doc/backend/pipeline/model_json_to_middle_json.py", line 59, in page_model_info_to_page_info
    spans = magic_model.get_all_spans()
            │           └ <function MagicModel.get_all_spans at 0x7f83f123e4d0>
            └ <rapid_doc.backend.pipeline.pipeline_magic_model.MagicModel object at 0x7f7f725b7550>
  File "/usr/local/lib/python3.10/site-packages/rapid_doc/backend/pipeline/pipeline_magic_model.py", line 376, in get_all_spans
    span['original_label'] = layout_det['original_label']
    │                        └ {'bbox': [443.16, 47.52, 447.84, 52.56], 'poly': [1231, 132, 1244, 132, 1244, 146, 1231, 146], 'category_id': 200, 'checkbox'...
    └ {'bbox': [443.16, 47.52, 447.84, 52.56], 'score': 0.9, 'content': '☑', 'type': 'checkbox'}

KeyError: 'original_label'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions