This error typically comes up when OSX is trying to access a file or folder on a remote server, but it cannot connect to that server.
I have two examples to give an idea of where this can come from:
You are able to have OSX connect to a remote folder automatically at
login. Typically these are shown in the "Login Items" tab of the
"Users & Groups" pref pane
When an application attempts to open a file that's on a remote
server, OSX automatically tries to connect to that server in order
to access the file.
For example: If the music in your iTunes library is on a mounted
network drive, and you have not connected the drive yet, playing a
track will delay while it connects the drive and then iTunes will
play the track.
In both cases, if the server where these files are located cannot be found, that error will come up.
Full disclosure: this was originally my answer to Endlessly repeating "There was a problem connecting..." error. That question has been marked as a duplicate of this one.