I just found the reason for this error. In my codebase, I have multiple .pdspec files defined (one per each SDK module). Some of the podspecs were complete and worked for a long time with no changes (except the version bumps). Other podspecs were introduced recently and are work-in-progress.
The error in question was happening while I was trying to either publish or lint the complete podspecs. However, as it appears (after digging into the Ruby scripts mentioned with the error log) that Cocoapods runs the validation step during both lint and publishing of a specific podspec. Part of the validation steps iterates through all .podspec files within the same directory (or maybe even directory tree – ? ). So, in my case, it was discovering the incomplete podspecs and trying to validate them as well (WHY?) and of cause failing with the error.
The error is not helpful at all to troubleshoot the problem as well as log traces reported with it. The only way to find out some helpful hints was to look into code blocks around the Ruby script-lines mentioned in the log and try to reverse engineer what possibly was going on wrong.
I just wanted to share my story and to possibly prevent other people from running into a similar error (a Google search shows a lot of those) and losing days in frustration trying to troubleshoot it.
CLICK HERE to find out more related problems solutions.