In my case, I was on a Korolov escort mission. I docked at a station near the destination station and when I undocked, I was attacked by 2 or 3 friendlies, who pursued me a considerable distance (probably over 100 ls), but eventually gave up. I'm fairly sure I hadn't even fired a weapon in the vicinity and I had no escorts. When I returned to the area later, no one was angry and I wasn't blacklisted at any stations.

As reported by Xephyr, here: I've run into a very odd bug a few times where every friendly in the system decides the player needs to die. Trying to reproduce this right now.

tarbos on 7/8/2016 9:22 AM:

This happened to me as well. I was Attacked by friendly stations while approaching them for the first time. So far by Tempus Lab, Black Market Shipyard, Thor's Wonderous Devices and Ringer Collective (and probably something i don't remember as well).

xephyr on 7/8/2016 10:05 PM:

The common factor in all of these, from what I've seen, is that the station has been previously attacked by enemies previously.

It seems easiest to reproduce this in EP, where the first system is full of goron/first hunters that will attack stations.

nms on 7/10/2016 8:13 PM:

It turns out it's not just the player. They occasionally attack other friendlies, even other ships guarding the same station! (Though I'm not completely certain there was no accidental friendly fire to precipitate it in that case.)

Xephyr: Agreed. I've never seen it from a station that hasn't been attacked by somebody (usually enemies). It seems like their anger is getting misdirected towards random nearby ships.

xephyr on 7/12/2016 6:51 PM:

After some testing, I found that when a station guard is destroyed by their own station, all station guards will attack the station.

assumedpseudonym on 7/26/2016 11:39 AM:

 I just found the wreck of the Kronosaurus on my way inbound on a superfreighter escort mission, presumably destroyed by the guards of the Commonwealth Fortress I was leading said superfreighter back to. I was welcomed with MAGs and TeV 9s.
 WARNING: Speculation mode engaged. Here’s the salt shaker.
 It seems like part of the issue might be that if an NPC ship is attacked, it checks the order target of the ship it was attacked by, possibly? The Kronosaurus is specifically targeting the playership when it shows up, after all. I can see where that sort of check would be implemented in the case of checking for autons controlled by the player. If I’m right about order targets, checking for (objGetProperty obj 'playerWingman) might be a better way to go than checking order targets.

nms on 7/27/2016 5:36 AM:

Oooh, that seems very plausible.

george moromisato on 7/27/2016 6:36 PM:

This is the bug:

https://github.com/kronosaur/Mammoth/blob/e7f65dfdf32cdd04ee11b2c017b0866856310eff/TSE/CStation.cpp#L2389

When a guard gets destroyed by a friendly (not necessarily the player) it sends a message to its station: msgDestroyedByFriendlyFire.

But if you look at the code, the station assumes the attacker was the player.

The fix is conceptually simple, but requires a bit of code. When we get this message, we need to go through the normal blacklist checked. Did the player (or an auton) do this? Does the station care about blacklisting? Was this accidental? Etc.

I've fixed this for 1.7 Alpha 2a. Thank you!