This sounds like a bad string, as was mentioned before.
If your set came with a bad string, the string got replaced, and is also bad, there might be something causing that.
That something might be on the bass guitar or it might be user error.
I would inspect everything that touches the D string, and look at the old string for potential damage. I see in the background of the headstock pic that some silk has accumulated at the string tree - is the string okay in that area? Are there sharp edges at the string tree?
Is the nut alright?
As I said, check everything that has direct contact with the string.