Skip to content

APIError HTTP 500 when updating one tag with existing search_criteria #314

Description

@NexCu

When I request a tag from Nexpose API, I got all information about it. This includes name, associated_asset_ids, search_criteria etc.

Expected Behavior

When I only update some tag.associated_asset_ids and the tag has also search_criteria, the tag should be updated without any issue.

Current Behavior

After updating of existing tag object for values in tag.associated_asset_ids, I do a tag.save(connection) and get an Error HTTP 500. Tags without search criteria can be updated without problems and I get HTTP 200 answer from Nexpose.

After some research I found the reason, but I don't understand why it is raised without change anything für search_criteria.

2018-02-04T12:29:16 [WARN] [Thread: http-nio-443-exec-172=/api/2.0/tags/9767] Encountered an internal server error.
org.springframework.dao.DuplicateKeyException: PreparedStatementCallback; SQL [INSERT INTO tag_criteria_asset_bridge (tag_id, asset_id) VALUES (?, ?)]; ERROR: duplicate key value violates unique constraint "tag_criteria_asset_bridge_pkey"
Detail: Key (tag_id, asset_id)=(9767, 3705) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "tag_criteria_asset_bridge_pkey"
Detail: Key (tag_id, asset_id)=(9767, 3705) already exists.

Your Environment

  • Nexpose gem version: 7.2.0
  • Ruby version: 2.5.0p0 (2017-12-25 revision 61468)
  • Operating System and version: CentOS
  • Nexpose product version: 6.5.4

Thanks for any support.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions