anchore-engine icon indicating copy to clipboard operation
anchore-engine copied to clipboard

image_package_db_entries insert "value too long for type character varying(74)"

Open ryanlraines opened this issue 2 years ago • 2 comments

Is this a request for help?: Yes


Is this a BUG REPORT or a FEATURE REQUEST? (choose one): BUG REPORT

Version of Anchore Engine and Anchore CLI if applicable: Anchore Engine = v0.8.2

What happened: Attempting to execute scans, but some (not all) are failing with [ERROR] Failed client call to service policy_engine for url: http://<REDACTED>:8087/v1/images. Response: {'httpcode': 500, 'anchore_error_raw': 'b\'{\\n "detail": {\\n "error_codes": []\\n },\\n "httpcode": 500,\\n "message": "(psycopg2.errors.StringDataRightTruncation) value too long for type character varying(74)

What did you expect to happen: Successful completion of scan

Any relevant log output from /var/log/anchore:

What docker images are you using: docker.io/anchore/anchore-engine:v0.8.2

How to reproduce the issue:

Anything else we need to know: Insert transaction: INSERT INTO image_package_db_entries (image_id, image_user_id, pkg_name, pkg_version, pkg_type, pkg_arch, pkg_path, file_path, is_config_file, digest, digest_algorithm, file_group_name, file_user_name, mode, size)

However, the offending insert does not contain any column values > 74

ryanlraines avatar Jul 30 '21 13:07 ryanlraines

If anyone finds themselves here, the fix that worked for me was altering the offending column to allow more characters.

ALTER TABLE image_package_db_entries ALTER COLUMN digest TYPE varchar(255); (255 was arbitrary, any number greater than the offending value would work)

Leaving open, as I believe there may be some bugfix required

ryanlraines avatar Aug 03 '21 18:08 ryanlraines

Hello @ryanlraines , thanks for bringing this to our attention. Could you retry scanning your image with v0.10.0 and let me know if you are still seeing this issue? We have made numerous improvements to the product including changes to the db schema since v0.8.2.

Toure avatar Aug 13 '21 23:08 Toure