Why do modules have bug reports? A good question was raised in this comment by EGHDK:


  Why do these modules have bug reports. Shouldn't this be a simple task for a module to complete with no errors?


He was referring to limiting the viewing of pages to users of a certain role, but the question applies broadly.
There's a big difference between creating a custom module for just one site (your own, let's say) and creating one that will be able to be used on many different sites. 

For example, let's say I want to limit access to a certain content type to only users of a certain role. Let's say that content type is 'awesome_thing' and the role is 'awesome_person'. There are two ways to go about this.


My own module that no one else will ever see or use


This would probably consist of something like a hook that gets called for each page, examines the $node object to see if it's 'awesome_thing' and then, if it is, examines the $user object to see if it's an 'awesome_person' and, if so, loads the page or whatever. 


A module that is fit for contribution to d.o contrib


This would have to include a configuration interface that allows users to specify which content types they want to restrict, and which roles they want to allow on those content types. If there's more than one combination of role and nodetype then you have to deal with that. Then, since you've given a mouse a cookie, people are going to have feature requests, or maybe they'll write patches that add features and you think they're cool and you want to integrate them into a new version of your module. 

Then say your module has a dependency on another module for some of these features, or your naming conventions conflict with another module's. On most sites this won't be noticeable so you probably wouldn't ever encounter it as a problem just on your own site. But by the law of large numbers, if you let a whole bunch of people use your module, they're more likely to discover corner cases where things work in unexpected ways than you are to think of every possible use case. 

And then someone might look at your module and see that you violated a coding standard or namespace convention. Or they might see that you used 5 lines of code to do something that could be better done in 3 lines, or that you did something that's going to be expensive on performance if the module is used on a large-scale site with higher traffic than yours. 

The tl;dr is that writing your own snippet for your one little use-case is exponentially less complex than writing, say, a patch for public consumption which itself is exponentially less likely than a full-blown module to both contain bugs and to have its existing bugs noticed and called out.