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

Fixing crash due to None author #650

Merged
merged 1 commit into from
Oct 29, 2024
Merged

Fixing crash due to None author #650

merged 1 commit into from
Oct 29, 2024

Conversation

jamesbraza
Copy link
Collaborator

Seen last night when indexing 19k PDFs:

    | Traceback (most recent call last):
    |   File "/path/to/.venv/lib/python3.12/site-packages/paperqa/agents/search.py", line 487, in process_file
    |     await tmp_docs.aadd(
    |   File "/path/to/.venv/lib/python3.12/site-packages/paperqa/docs.py", line 364, in aadd
    |     doc = await metadata_client.upgrade_doc_to_doc_details(
    |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "/path/to/.venv/lib/python3.12/site-packages/paperqa/clients/__init__.py", line 207, in upgrade_doc_to_doc_details
    |     0 if not extra_fields else DocDetails(**extra_fields)
    |                                ^^^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "/path/to/.venv/lib/python3.12/site-packages/pydantic/main.py", line 212, in __init__
    |     validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self)
    |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "/path/to/.venv/lib/python3.12/site-packages/paperqa/types.py", line 577, in validate_all_fields
    |     data = cls.remove_invalid_authors(data)
    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "/path/to/.venv/lib/python3.12/site-packages/paperqa/types.py", line 458, in remove_invalid_authors
    |     a for a in authors if a.lower() not in cls.AUTHOR_NAMES_TO_REMOVE
    |                           ^^^^^^^
    | AttributeError: 'NoneType' object has no attribute 'lower'
    +------------------------------------

@jamesbraza jamesbraza added the bug Something isn't working label Oct 29, 2024
@jamesbraza jamesbraza self-assigned this Oct 29, 2024
@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Oct 29, 2024
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Oct 29, 2024
@jamesbraza jamesbraza merged commit ae3ca51 into main Oct 29, 2024
3 of 5 checks passed
@jamesbraza jamesbraza deleted the author-none-type branch October 29, 2024 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working lgtm This PR has been approved by a maintainer size:XS This PR changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants