Skip to content

Conversation

@aayushkdev
Copy link
Collaborator

Fixes #1526

Added exception handling for UnicodeDecodeError and added a catch all exception for load_json_from_file

@aayushkdev aayushkdev force-pushed the issue-#1526 branch 2 times, most recently from a678664 to 02f9a7a Compare April 1, 2025 16:49
Copy link
Member

@AyanSinhaMahapatra AyanSinhaMahapatra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aayushkdev Thanks, but this is not the correct way to do this. See comments.

return json.load(f)
except json.JSONDecodeError:
return
except UnicodeDecodeError as e:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This still creates an exception and this breaks the pipeline run, we need to catch and create a ProjectMessage https://github.com/aboutcode-org/scancode.io/blob/main/scanpipe/models.py#L1399 object to keep these in the /messages/ tab for that project, instead of raising an exception. Check similar invocations elsewhere for how to do this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please run a d2d pipeline using the inputs at #1526 (comment), this should create an error message and the pipeline should complete successfully.

@aayushkdev aayushkdev closed this Sep 8, 2025
@aayushkdev aayushkdev deleted the issue-#1526 branch September 8, 2025 17:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: 'utf-8' codec can't decode byte 0x80 in position 8: invalid start byte

2 participants